Another way to launch a process is to put a shell command line between backquotes. This fires off a command and waits for its completion, capturing the standard output as it goes along:
@files = `dir`; # gets dir output
The value of
@files
is the text from the
dir
command, so it might look something like:
Volume in drive D has no label. Volume Serial Number is 9C5D-713A Directory of D:\ora\eg 05/19/97 11:54p <DIR> . 05/19/97 11:54p <DIR> .. 04/12/97 11:12a 23 bell.pl 04/12/97 10:56a 73 console.pl
The standard input and standard error of the command within backquotes are inherited from the Perl process.[ 1 ] In other words, the value of the backquoted string is normally just the standard output of the commands within the backquotes.
[1] Actually, the situation is a bit more complicated. See the question in Section 8 of the Perl FAQ on "How can I capture STDERR from an external command?"