Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: regex expression help

by bangers (Pilgrim)
on Nov 08, 2005 at 17:10 UTC ( [id://506810]=note: print w/replies, xml ) Need Help??


in reply to regex expression help

This should work
my @dependantFiles = ( 'aa', 'bb', 'cdef' ); my @namedFiles = ( 'cc', 'bb', 'dde' ); for my $y ( @dependantFiles ) { if( grep /$y/i, @namedFiles) { print "Found $y \n"; last; } else { print "not $y \n"; } }

Replies are listed 'Best First'.
Re^2: regex expression help
by bangers (Pilgrim) on Nov 08, 2005 at 17:21 UTC
    on second thoughts, probably best to use this:
    my @dependantFiles = ( 'aa', 'bb', 'cdef' ); my @namedFiles = ( 'cc', 'bb', 'dde' ); for my $y ( @dependantFiles ) { if( grep /^$y$/i, @namedFiles) { print "Found $y \n"; last; } else { print "not $y \n"; } }
    that way the file 'abc' in @namedFiles won't be tripped up if 'abcd' is in @dependantFiles

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-25 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found