in reply to Re: System(), writing to a new file
in thread System(), writing to a new file
As mentioned below, system(@list) doesn't invoke the shell. This is usually a good thing, but in this case the shell redirection the OP is expecting won't work. system($string) invokes the shell. Hence, system("sort $infile > $outfile") will work.
However, there's a better approach: Use the -o flag to sort(1), like this: @args = 'sort', '-o', $outfile, $infile; system(@args);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: System(), writing to a new file
by cyates (Novice) on Jul 19, 2013 at 00:52 UTC | |
by zork42 (Monk) on Jul 19, 2013 at 15:05 UTC |