Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: What's wrong with this grep?

by graff (Chancellor)
on Nov 07, 2009 at 07:39 UTC ( #805623=note: print w/replies, xml ) Need Help??


in reply to What's wrong with this grep?

Alternately to what JavaFan said, you could also do this:
use File::Slurp; chdir "/tmp/test"; my @files = grep { -f and /^\d{8}\.\d{6}\.host\d\.\d{1,6}$/ } read_dir + "."; print "Got ". scalar(@files) . "\n";
Of course, if the script is going to do anything else, and needs to keep track of the original working directory, use Cwd to find out where you are before you do chdir.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2023-02-07 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (38 votes). Check out past polls.

    Notices?