Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 "$_"; } }


Comment on Re: How to I check if a value is present in an array?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2014-09-02 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls