Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: passing a variable value to Unix command

by graff (Chancellor)
on Oct 20, 2010 at 02:23 UTC ( [id://866228]=note: print w/replies, xml ) Need Help??


in reply to passing a variable value to Unix command

Depending on how many patterns you need to locate, and how long it takes for unix 'find' to traverse the given directory tree, you might want to consider running 'find' just once, and use perl's grep function to pull out the desired file names:
my $file_regex = join( '|', @a ); my @found = grep /^(?:$file_regex)\./, `find . -print`;
(BTW, I think '-print' is on by default -- you probably don't need to include that in the 'find' command.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-18 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found