I have an array in the format:
@arr = ABHCKPDLT OJEWFNONP POJEWPOFJ IWOJEFPPW IHWEF_IPIA
I need to check is the number of elements limit say 4k characters, is reached. If so, a new array has to be created and store next limit of arrays.
@arr_final = [[ABHCKPDLT OJEWFNONP POJEWPOFJ],[IWOJEFPPW IHWEF_IPIA]]
#!usr/bin/perl
use List::MoreUtils qw(natatime);
my @VAR;
{
my $iter = natatime 3, @arr;
while( my @tmp = $iter->() ){
push @VAR, \@tmp;
}
}
Please suggest what would be best approach in perl.
natatime()to extract three elements at a time from your array. So where does the 4K character limitation come in?