Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1020113]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2025-02-12 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found