Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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?

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

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://390185]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-01-20 07:39 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.