On 3/13/07, Paul <[EMAIL PROTECTED]> wrote:
On Tue, March 13, 2007 2:38 am, yitzle wrote:
> Where you doing "rm -f $file" or `rm -f $file`?
> You need to use "backticks" for system commands.
If memory serves me, back ticks are only needed inside a system command
for UNIX commands and regular ticks specifying the system command within
the Perl script.
snip
Backticks are the specialized form of the qx// operator. It runs the
string inside of the /s in the system's shell and returns the stdout
as an array of lines or a scalar containing the entire output
depending on the context:
my @files = qx/ls/; #each file is a separate entry in @files
my $files = qx/ls/; #scalar value containing the entire output of ls
The system function forks and then execs the command given to it
(either with the default shell or execvp depending on the arguments).
The parent then waits for the child to finish and returns the exit
status of the program as returned by the wait function.
The two things have nothing to do with each other.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/