in reply to Re: Can't use string ("...") as an ARRAY ref while "strict refs" in use at x.pl line ...
in thread Can't use string ("...") as an ARRAY ref while "strict refs" in use at x.pl line ...
Why does each chunk appear to have 101 elements?
c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dumper; my @a = (1..1284); my $chunkedRef = chunky(@a); sub chunky { my %master; for(0..int @_/100) { push @{$master{$_+1 . ' key'}},@a[$_*100..$_*100+100]; } return \%master; } print 'elements per chunk: ', scalar @{ $chunkedRef->{'1 key'} }; " elements per chunk: 101
|
|---|