Thanks John, worked as a treat. Appreciate it.
On Sun, Aug 19, 2012 at 11:18 PM, John W. Krahn <jwkr...@shaw.ca> wrote: > jet speed wrote: > >> Hi All, >> > > Hello, > > > Is there a way to find matching array elements from hash. >> >> ex: >> >> @names = ( abc. def. ghi, jky; ); >> >> %stud = ( >> " abc" =>" 34", >> "nba" =>"99", >> "def" =>"24", >> "ghi"=> "33"); >> >> How can i go throught each elements of has %stud and print the matching >> array value in this case >> >> abc =34 >> def=24 >> > > $ perl -e' > my @names = qw( abc def ghi jky ); > my %stud = ( > > abc => 34, > nba => 99, > def => 24, > ghi => 33, > ); > print map exists $stud{ $_ } ? "$_ = $stud{ $_ }\n" : (), @names; > ' > abc = 34 > def = 24 > ghi = 33 > > > > > John > -- > Any intelligent fool can make things bigger and > more complex... It takes a touch of genius - > and a lot of courage to move in the opposite > direction. -- Albert Einstein > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > >