On Wednesday, January 21, 2004 10:53, McMahon, Chris queried:
>
>But this script doesn't do right in Windows: 

Modify the code as shown, and it should work:

>use warnings; 
>use strict; 
>my $dir = "E:\\Documents and Settings\\cmcmahon\\Desktop"; 

You have to escape the spaces, and for some reason, using backslashes seems
to cause Perl problems here.  And put the string in single quotes, so the
backslash in front of the spaces is retained.  So, change it to read as
follows:

     my $dir = 'E:/Documents\ and\ Settings/cmcmahon/Desktop';

>print "$dir\n";  
>my @files = glob( "$dir\\*");

You need a forward slash here as well.

     my @files = glob("$dir/*");

>print @files; 

I would change this (only to make it look nicer, one filename per line) to:

     print "$_\n" for @files;

HTH,
Alan

-- 
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