Why does dir produce different results when called from Perl

2006-04-06 Thread Michael Goldshteyn
That is, why does the output differ between: perl -e "print join(\"\n\",@{[`dir`]});" and dir | perl -pne "" -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Mr. Shawn H. Corey
On Thu, 2006-06-04 at 10:42 -0500, Michael Goldshteyn wrote: > That is, why does the output differ between: > > perl -e "print join(\"\n\",@{[`dir`]});" > > and > > dir | perl -pne "" Different environments. Use File::Find instead. See `perldoc File::Find` for details. -- __END__ Just my 0.

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Michael Goldshteyn
What does different environments mean? Why should the two uses of dir differ in their output? "Mr. Shawn H. Corey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 2006-06-04 at 10:42 -0500, Michael Goldshteyn wrote: >> That is, why does the output differ between: >> >> perl

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread JupiterHost.Net
Michael Goldshteyn wrote: What does different environments mean? Why should the two uses of dir differ in their output? because system calls rely on you ENV via CLI and %ENV when called in perl. (IE *you* are executing it in CLI and *perl* is executing it when using backticks = different e

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Jay Savage
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

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Michael Goldshteyn
Point taken about the call to join(). With regards to the difference between the two samples, the difference is larger than new-lines. DIR from the command line shows info about file like their date of last change and size. It also shows how many bytes are used in the directory being DIRed and

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread JupiterHost.Net
Michael Goldshteyn wrote: Point taken about the call to join(). perl -e 'print for `dir`;' Is even sexxierr :) With regards to the difference between the two samples, the difference is larger than new-lines. DIR from the command line shows info about file like their date of last chang

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Michael Goldshteyn
The answer to my own question in the OP. There is a difference, because the following should be performed to get the behavior of: dir | perl -pne "" perl -e "print `cmd /C dir`;" the cmd /C part is required to get equivalent behavior. Mystery solved! "Michael Goldshteyn" <[EMAIL PROTECTED]> w

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Jay Savage
On 4/6/06, Michael Goldshteyn <[EMAIL PROTECTED]> wrote: > Point taken about the call to join(). > > With regards to the difference between the two samples, the difference is > larger than new-lines. DIR from the command line shows info about file like > their date of last change and size. It also

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Michael Goldshteyn
"Jay Savage" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 4/6/06, Michael Goldshteyn <[EMAIL PROTECTED]> wrote: >> Point taken about the call to join(). >> >> With regards to the difference between the two samples, the difference is >> larger than new-lines. DIR from the comman

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Dr.Ruud
Michael Goldshteyn schreef: > By the way, the output of perl -e "print `dir`;" has: > > - All files/dirs with spaces have the spaces escaped with a backslash > (e.g. a file such as "Hello there.txt" looks like "Hello\ there.txt" > - The output is similar to dir /W, except that the header > (volume

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Mr. Shawn H. Corey
On Thu, 2006-06-04 at 13:35 -0500, JupiterHost.Net wrote: > perl -e 'print for `dir`;' > > Is even sexxierr :) dir /w Not sexy but simple. -- __END__ Just my 0.0002 million dollars worth, --- Shawn "For the things we have to learn before we can do them, we learn by doing them."

Re: Why does dir produce different results when called from Perl

2006-04-06 Thread John W. Krahn
Michael Goldshteyn wrote: > That is, why does the output differ between: > > perl -e "print join(\"\n\",@{[`dir`]});" > > and > > dir | perl -pne "" $ which dir $ alias dir alias dir='ls -l' $ unalias dir $ alias dir bash: alias: dir: not found $ which dir /usr/bin/dir It looks like the first

RE: Re: Why does dir produce different results when called from Perl

2006-04-06 Thread Timothy Johnson
ad more I anticipate more people running into this issue when they try to invoke cmdlets as executables. -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Michael Goldshteyn Sent: Thursday, April 06, 2006 12:02 PM To: beginners@perl.org Subject: Re: Why does dir produ