On 4/6/06, Michael Goldshteyn <[EMAIL PROTECTED]> wrote:
> That is, why does the output differ between:
>
> perl -e "print join(\"\n\",@{[`dir`]});"
>
> and
>
> dir | perl -pne ""

First of all, you haven't told us how it differs. Since dir is an
os-specific command, most of the people on this list can't duplicate
your results for themselves.

On a side note, why do you mess around with with the anonymous array nonsense?

    print join("\n", `dir`);
    #  perl -e "print join(\"\n\", `dir`);"

yeilds the same result with half the complexity.

That said, the only differnce I see between the piped system command
and the backticks when I run your code is in the line spacing. This is
because you've asked perl to double space the lines. As you can see
from the output of dir or

    perl -e "print `dir`"
    # or for that true array experience:
    # perl -e "print @{[`dir`]}"

dir returns newlines as part of the data stream. unless you chomp them
off, they stay there. And when you join with \n, you add a second
newline to the end of every element in the list.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to