Hack-R Hack-R - 7 months ago 6
Perl Question

Why doesn't Perl see my file in the working Windows directory?

I'm using the current release of Strawberry Perl and Windows Server 2008.

For some reason Perl doesn't seem to find files in the current working directory:

F:\temp\hackr\e>ls
test.csv train.csv

F:\temp\hackr\e>perl -ne 'print if (rand() < .01)' train.csv
The system cannot find the file specified.

mob mob
Answer

On the Windows command line, use double quotes around command line arguments that need quoting.

perl -ne "print if (rand() < .01)" train.csv
Comments