Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Ignore file in array without looping

by hdb (Parson)
on Mar 27, 2013 at 18:17 UTC ( #1025779=note: print w/ replies, xml ) Need Help??


in reply to Ignore file in array without looping

My proposal: build a dynamic pattern from your @array_code

my @array_code = qw(x-01 x-02 x-03 x-04 v-05 v-06 v-07 x-08 x-09 x-10 +x-11); my $pattern = "(".join("|", @array_code ).")"; my @files = qw(1234567_x-01_2013_03.txt 1234667_x-03_2013_03.txt 0034 +567_y-01_2013_03.txt 1234567_v-01_2013_03.txt 233567_v-05_2013_03.tx +t 1234567_x-55_2013_03.txt); for my $file (@files) { next if $file =~ /$pattern/; print $file,"\n"; }


Comment on Re: Ignore file in array without looping
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-08-23 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls