Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 taking refuge in the Monastery: (21)
As of 2014-07-11 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (229 votes), past polls