laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Firstly, you're using array slices for your assignment, which I believe is not what you want, but I digress.
The first method works because the string that system gets is passed to a shell (usually something like `sh -c $str`) so it executes it as you might expect. The second method doesn't work because what happens is that system takes the first element in the array as the program to execute, and the remaining elements as arguments to be passed to that program. So the reason it won't work is that gawk is also taking '>' and 'out.file' as arguments, when you really want the shell to interpret them. HTH broquaint P.S If you're stuck with [mgn]awk scripts you might want to take to them with a2p which comes with the standard perl distro. In reply to Re: Array for system() call
by broquaint
|
|