[Israel.pm] using "system"

Tal Kelrich tal at musicgenome.com
Sun Oct 31 04:52:53 PST 2004

On Sun, 31 Oct 2004 14:23:30 +0200
Offer Kaye <offer.kaye at gmail.com> wrote:

> On Sun, 31 Oct 2004 11:28:30 +0000, Mikhael Goikhman
> <migo at homemail.com> wrote:
> > 
> > Here is an example of both:
> > 
> >   system("ls", "-al");
> > 
> >   system {"ls"} "dir", "-al";
> I think I get it - the "system PROGRAM LIST" format of the command is
> just a way of "fooling" the program into thinking it is running as
> "dir" while it is really running "ls"?

It's also useful for running programs with strange characters in the argument list, which may be interpreted by the shell otherwise. (as perl will not pass it through "/bin/sh -c", so no shell expansion will occur)
I use this as my default form, as it is much safer than the alternative IMHO.

Tal Kelrich
PGP fingerprint: 3EDF FCC5 60BB 4729 AB2F  CAE6 FEC1 9AAC 12B9 AA69
Key Available at: http://www.hasturkun.com/pub.txt
Intuition, however illogical, is recognized as a command prerogative. --
Kirk, "Obsession", stardate 3620.7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20041031/9cd013d1/attachment.pgp 

More information about the Perl mailing list