Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone have any example code that invokes a shell command from within a script and then gets it's assigns its output to a Perl varible.

Replies are listed 'Best First'.
Re: Spawning Shell Commands
by le (Friar) on Jun 06, 2000 at 14:32 UTC
    Use backticks:
    @output = `command`;

    Or use a pipe:
    open(PIPE, "command |") or die $!; while (<PIPE>) { print; # ..do something else }