Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to I check if a value is present in an array?

by mtmcc (Hermit)
on Aug 03, 2013 at 11:00 UTC ( #1047695=note: print w/replies, xml ) Need Help??


in reply to How to I check if a value is present in an array?

Maybe something like this?:

#!/usr/bin/perl use strict; use warnings; my @arrayONE = ("rabbits", "horses", "oranges"); my @arrayTWO = ("truck", "boat", "oranges"); for (my $x = 0; $x <= $#arrayONE; $x += 1) { for (@arrayTWO) { print STDERR "SHARED: $_\n" if $arrayONE[$x] eq "$_"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047695]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2016-12-08 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (144 votes). Check out past polls.