Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: using hash to compare with string and print the string

by holli (Monsignor)
on May 15, 2019 at 14:32 UTC ( #11100019=note: print w/replies, xml ) Need Help??


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
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11100019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2019-06-26 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (110 votes). Check out past polls.

    Notices?