in reply to Another system redirect problem

Well thanks to all who posted.

You exposed a flaw in my thought process... I was thinking of system(@xyz) as only suspending metachar expansion, but of course if I can't already do that in the shell why would it work in perl. I saw '>>' as part of the shell's command expansion. But I didn't realise that system(@abc) executes the called program directly, so does no shell expansion.

I hadn't realised that it would be so complicated for a late night 'simple' task.

I think that all the solutions posted (correct me if I'm wrong (again)) are effectively variations on using a pipe and capturing the output into the wanted file. For my comfort zone I'll stick with the core perl solution rather than the lower level IPC stuff.

Thanks for your time, I hope this question saves a few others from the confusion I created for myself

Replies are listed 'Best First'.
Re^2: Another system redirect problem
by ikegami (Patriarch) on Jun 19, 2011 at 19:50 UTC

    I think that all the solutions posted (correct me if I'm wrong (again)) are effectively variations on using a pipe and capturing the output into the wanted file.

    Neither of my solutions use pipes. They just do output redirection like the shell would.

    The other solution given does use a pipe, which means the output isn't going to a file. It is placed in the file by the script which gets it from the pipe.

      Yes, sorry, you are correct. It's a problem of a little knowledge being not enough to to express myself succinctly. I'm not quite there with IPC utilities yet, they seem a bit intimidating.