in reply to Re: Re: Perl Style: About error messges opening files
in thread Perl Style: About error messges opening files

I would imagine that Abigail avoided:

system("mkdir -p $foo");

because that would be interpreted by the shell, and would foul up if (for example) $foo contained a filename with spaces. The advantage of using the arrow instead of the comma is that you can get away with less quoting, compare:

system mkdir => -p => $foo; system 'mkdir', '-p', $foo;

Same number of chars, arguably more readable.

Replies are listed 'Best First'.
Re: Re^3: Perl Style: About error messges opening files
by eserte (Deacon) on Apr 27, 2004 at 14:43 UTC
    To safe another char, one could write

    system qw(mkdir -p), $foo;

    But best would be if perl had a backtick operator like lisp (that is elisp, don't know about other lisp implementations):

    system `(mkdir -p ,$foo);