Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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 having an uproarious good time at the Monastery: (5)
As of 2018-03-19 00:04 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.