Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How to compare Array values??

by markkawika (Monk)
on Jul 13, 2009 at 17:58 UTC ( [id://779692]=note: print w/replies, xml ) Need Help??


in reply to How to compare Array values??

Your code doesn't match what you say.

Do you want to check to see if the first element of Array1 contains the literal string $Array2[0] ? Because that's what your code does.

If, instead, you have a regex stored in $Array2[0], and you want to use that to attempt to match against the string stored in $Array1[0], you need to not quote the variable:

if ($Array1[0] =~ m{$Array2[0]}) { print "PASS\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-09-10 00:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.