How to run a command and save the output, in Perl

Assuming we are in a directory that contains a file called


>perl -e “open(FOO,’cat myfile |’)|| die ‘cat failed’; while (){ print }”

Now I can treat FOO just like I would any other filehandle.

Leave a Reply

You must be logged in to post a comment.