Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. # A list of more than 1000 numbers separated by commas
  2. my $list = '1444,99,112,1233,174,224,443,672,32,9821,...';
  3.  
  4. my $i = 0;
  5. my @arr = split(',', $list);
  6.  
  7. # Move through the @arr copying elements to a temporary @subset array
  8. # Do this in batches of 400
  9. while ( $i le $#arr ) {
  10. my @subset;
  11. my $s = 1.0 * scalar(@subset);
  12.  
  13. while ( $s le 400 ){
  14. push ( @subset, $arr[$i] );
  15. $s = 1.0 * scalar(@subset);
  16. $i++;
  17. }
  18.  
  19. # Do something with the @subset array here
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement