Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: File::Find problems

by tradez (Pilgrim)
on Sep 10, 2004 at 20:53 UTC ( #390185=note: print w/ replies, xml ) Need Help??


in reply to File::Find problems

Well this might be OVERsimplifying things a bit, but hey, isn't that what perl is?

my @files = `ls -l /dir/to/be/search`; foreach my $file (@files) { do whatever }
Help any?


Tradez
"Never underestimate the predictability of stupidity"
- Bullet Tooth Tony, Snatch (2001)


Comment on Re: File::Find problems
Download Code
Re^2: File::Find problems
by sintadil (Pilgrim) on Sep 10, 2004 at 22:14 UTC

    A couple of notes about that:

    1. ls doesn't exist everywhere. I didn't see any mentioning in the OP about any particular OS, so it's not safe to assume that the user is on a Unix-alike or something with an ls command (though ppt definitely comes close).
    2. ls -l generates a lot of surplus output besides just the files. Furthermore, the output of ls -l is probably not standardised across different Unix systems.

      I agree that using "ls" in backticks is poor style and not to be encouraged. As for point 2, I wonder wether tradez actually intended to use the digit "-1" instead of the letter "-l" (so easy to get these mixed up) -- in any case, the digit "-1" option is of course unnecessary in this context, just as the letter "-l" option is unsuitable. Bad form all around.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (16)
As of 2014-10-21 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (105 votes), past polls