From: Philip S T. <phi...@gm...> - 2002-07-16 09:52:48
On Tue, 16 Jul 2002, Stefan Svensson wrote:
> Sorry for bothering you with a simple, off-topic question to which I can't
> find any answer elsewhere.
>
> Can someone provide a simple one-liner to convert a array-of-hashes to an
> array of values for a specified hash key?
Please note the change in list address.
This might work:
my @lov = map {$_->{$key}} @hash_array;
From: Roger B. W. <ro...@fi...> - 2002-07-16 10:06:10
On or about Tue, Jul 16, 2002 at 03:16:28PM +0530, Philip S Tellis typed:
>This might work:
>
>my @lov = map {$_->{$key}} @hash_array;
Not quite - this will insert undefs in the list if the key doesn't exist
in all hashes. See my version which checks for this.
Cheers,
Roger