Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Search in array from match in another array, print once only.

by tmharish (Friar)
on Feb 22, 2013 at 09:37 UTC ( #1020113=note: print w/ replies, xml ) Need Help??


in reply to Re: Search in array from match in another array, print once only.
in thread Search in array from match in another array, print once only.

More importantly its more efficient if you use a hash:

use strict ; use warnings ; my @array = ( "54321", "54312", "5999", "54352", "12345" ) ; my @original = ( "12345" , "54321" , "12355" ) ; my %hash = map( { ( $_ => 1 ) } @original ) ; print "". ( ( $hash{ $_ } ) ? "$_ Found\n" : "$_ Not Found\n" ) foreac +h ( @array ) ;


Comment on Re^2: Search in array from match in another array, print once only.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2015-05-06 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (130 votes), past polls