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

Re: Ignore file in array without looping

by hdb (Prior)
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 musing on the Monastery: (11)
As of 2015-07-06 19:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls