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

Jeff Bragg jackofnotrades at gmail.com
Fri Dec 19 18:59:09 PST 2008


That seems subjective to me.  I don't find qx{} or $() any more legible than
backticks (perhaps less so because I'm used to using backticks), but YMMV.
I guess that why TIMTOWTDI.

On Fri, Dec 19, 2008 at 5:39 PM, David Alban <extasia at extasia.org> wrote:

> 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.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20081219/9a53686a/attachment.html>


More information about the SanFrancisco-pm mailing list