http://qs321.pair.com?node_id=1089300


in reply to Can't use string ("...") as an ARRAY ref while "strict refs" in use at x.pl line ...

Code rewrite

use warnings; use strict; use Data::Dumper; my @a = (1..1284); my $chunkedRef = chunky(@a); sub chunky { #for chunks (chunks = 100 blocks of passed -in array) + + my %master; for(0..int @_/100) { # create an array for each 100 elements and add it to the has +h + push @{$master{$_+1 . ' key'}},@a[$_*100..$_*100+100]; } return \%master; } print Dumper %$chunkedRef; 1;

Celebrate Intellectual Diversity