in reply to Re: Loop through array of hashes
in thread Loop through array of hashes
It's that classic blunder, less well known than getting involved in a land war in Asia: use of numbered variables instead of an array! Especially when the OP calls for it.
use strict; use warnings; my @aoh; push @aoh, { one => 1, two => 2 }; push @aoh, { three => 3, four => 4 }; push @aoh, { five => 5, six => 6 }; dump_keys( $_ ) for @aoh; sub dump_keys { print "$_\n" for keys %{+shift} }
Update: jeffa has since revised his answer to make my comment irrelevant.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Loop through array of hashes
by Anonymous Monk on Jan 21, 2016 at 21:49 UTC |