in reply to extracting values from hashes
See. exists and grep for more info.my @array = qw/sarah john/; my %hash = ( sarah => 19, john => 25, emma => 22, ); print "$_: $hash{$_}\n" for grep exists $hash{$_}, @array; __output__ sarah: 19 john: 25
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: extracting values from hashes
by Anonymous Monk on Mar 18, 2003 at 14:13 UTC | |
by broquaint (Abbot) on Mar 18, 2003 at 14:22 UTC | |
by Anonymous Monk on Mar 18, 2003 at 14:30 UTC | |
by broquaint (Abbot) on Mar 18, 2003 at 14:57 UTC |