in reply to Help with array ref in hashes
I, too, seem to be getting the output I think you want to get from the OPed code (with missing $ sigil restored):
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my $line = 'foo'; my @data = qw(hi ha ho); my @site = (9, 8, 7); my %lengths; ;; $lengths{$line} = { x => $site[0], y => $site[1], z => \@data }; dd \%lengths; ;; for my $coord (keys %lengths) { for (@{$lengths{$coord}{z}}) { print $_; } } " { foo => { x => 9, y => 8, z => ["hi", "ha", "ho"] } } hi ha ho
Give a man a fish: <%-(-(-(-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with array ref in hashes
by diyaz (Beadle) on Jan 12, 2015 at 15:28 UTC |