The diamond operator works fine without escaping your backslashes, but I
recommend putting quotes around your arguments.  The following works
just fine for me:

     c:\> while.pl "c:\documents and settings\username\desktop\file.txt"


If you want to use the less-than operator (or a pipe), then you have to
explicitly state that you are using perl.exe.  cmd.exe can't derive
implicitly the program you are invoking via the extension.

For example:

     c:\> perl.exe while.pl < "..\myfile.txt"





-----Original Message-----
From: Hardly Armchair [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 15, 2006 6:41 PM
To: beginners@perl.org
Subject: [Win32] Basic I/O Question

Hello List,

I am running Perl for Win32 and have been executing my
programs through the 'cmd.exe' shell.

I am confused about how to input paths to files in a
command-line context so that perl will understand.

Using the diamond operator (<>) in my programs allows
me to type my program at the command line followed by
the filename to get the program to work on the file:

>foo.plx filename.txt    #works

However, when I use standard input (<STDIN>) and use
the "less than" character to do the same thing, the
file is ignored:

>foo.plx < filename.txt  #no dice

<snip>




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to