Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # A list of more than 1000 numbers separated by commas
- my $list = '1444,99,112,1233,174,224,443,672,32,9821,...';
- my $i = 0;
- my @arr = split(',', $list);
- # Move through the @arr copying elements to a temporary @subset array
- # Do this in batches of 400
- while ( $i le $#arr ) {
- my @subset;
- my $s = 1.0 * scalar(@subset);
- while ( $s le 400 ){
- push ( @subset, $arr[$i] );
- $s = 1.0 * scalar(@subset);
- $i++;
- }
- # Do something with the @subset array here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement