[sf-perl] executing a batch command in a Perl program

David Alban extasia at extasia.org
Fri Dec 19 17:39:39 PST 2008

both in perl and in shell backticks produce less readable code and in
both languages there's a Better Way To Do It.

use qx{  } in perl and $(  ) in shell.  there is no reason to use
backticks ever again.

in shell, $(  ) has the additional benefit of being nestable.

for qx{  } see the perlop man page.  for $(  ) see the bash (or ksh) man page.

On Fri, Dec 19, 2008 at 11:04 AM, Jeff Bragg <jackofnotrades at gmail.com> wrote:
> You can also use backticks if you want to save/use the output, as in:
> my @batch_cmd_output  =  `./myshellscript -opt1 -opt2`;

Live in a world of your own, but always welcome visitors.

More information about the SanFrancisco-pm mailing list