Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Pattern Match in @array

by marcink (Monk)
on Jun 11, 2001 at 19:08 UTC ( [id://87524]=note: print w/replies, xml ) Need Help??


in reply to Pattern Match in @array

You could use this:
#!/usr/bin/perl -w use strict; my @arr = qw( file1 file2 file3 filename ); print "ha!\n" unless grep /^filename$/, @arr;


See also the '-e' operator -- you don't have to list a directory to check if a file exists.

-mk

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-19 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found