I'm having a problem creating a hash of arrays. The while loop below works, but it's working too well. ;) Instead of giving me 5 values (from the example data below), it's giving me 25. I don't understand why it seems to be "looping" through the push statement.
If someone could explain what I'm doing wrong, I'd appreciate it. I just can't see it. Thanks, Frank -------------------------- use strict; use warnings; use 5.010; use Data::Dumper; my %entries; while (my $line = <DATA>) { chomp $line; my($state, $zipcodes) = split (/=/, $line); push( @{ $entries{$state} }, split( /,/ => $zipcodes) ) } foreach my $state (sort keys %entries) { say "The Zip Codes of $state are"; foreach (@{$entries{$state}}) { print Dumper (@{$entries{$state}}); } } __DATA__ AK=995,996,997,998,999 --OUTPUT-- The Zip Codes of AK are $VAR1 = '995'; $VAR2 = '996'; $VAR3 = '997'; $VAR4 = '998'; $VAR5 = '999'; $VAR1 = '995'; $VAR2 = '996'; $VAR3 = '997'; $VAR4 = '998'; $VAR5 = '999'; $VAR1 = '995'; $VAR2 = '996'; $VAR3 = '997'; $VAR4 = '998'; $VAR5 = '999'; $VAR1 = '995'; $VAR2 = '996'; $VAR3 = '997'; $VAR4 = '998'; $VAR5 = '999'; $VAR1 = '995'; $VAR2 = '996'; $VAR3 = '997'; $VAR4 = '998'; $VAR5 = '999'; http://www.surfshopcart.com/ Setting up shop has never been easier! Now on GitHub https://github.com/surfshopcart/surfshop -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/