Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 lurking in the Monastery: (14)
As of 2014-12-18 20:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (61 votes), past polls