Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible without using a loop to assign all the values for one key of all the hashes to an array?@AoH = ( { husband => "barney", wife => "betty", son => "bamm bamm", }, { husband => "george", wife => "jane", son => "elroy", }, { husband => "homer", wife => "marge", son => "bart", }, );
Something along the lines of:
@husbands = @AoH->{husband};
so @husbands contains ("barney", "george", "homer")
Cheers
Weevil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get AoH values into array
by FunkyMonk (Bishop) on Sep 06, 2007 at 18:07 UTC | |
by starX (Chaplain) on Sep 06, 2007 at 18:23 UTC | |
by FunkyMonk (Bishop) on Sep 06, 2007 at 18:39 UTC | |
|
Re: Get AoH values into array
by throop (Chaplain) on Sep 07, 2007 at 02:36 UTC | |
by Anonymous Monk on Sep 07, 2007 at 08:09 UTC |