in reply to using hash to compare with string and print the string
You don't need to create any intermediate arrays or for loops.
Just ask the hash wether it contains the key you want
holli
You can lead your users to water, but alas, you cannot drown them.
foreach my $key (@array) { if (exists $hash{$key} ) { print "array element: $key = $hash{$key} inside \%hash\n"; } else { next } }
holli
You can lead your users to water, but alas, you cannot drown them.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: using hash to compare with string and print the string
by daxim (Curate) on May 15, 2019 at 15:53 UTC |
In Section
Seekers of Perl Wisdom