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

Re: storing system function output

by doug (Pilgrim)
on Mar 12, 2010 at 14:58 UTC ( #828313=note: print w/replies, xml ) Need Help??

in reply to storing system function output

system doesn't glue in STDIN/STDOUT/STDERR, so you'll have to do that on your own. Generally use the open with a bar (pipe character) to launch programs where you need to capture the output. Try RTFM:

perldoc -f open

I don't think I'd ever launch ls as a child process because it is too easy to get that information on your own. opendir and readdir work will do nearly anything that you need for filenames. And for this particular case, there is a specialised tool for that:

my @files = glob("/path/to/directory/*");

The docs for opendir, readdir, closedir and glob are all in perlfunc so you can use perldoc -f OP to view them.

- doug

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-09-25 03:12 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (276 votes). Check out past polls.