Edward Yang wrote:
> I'm not sure if this is a bug.
>
> I'm running Perl 5.8 on a Windows 2000 Pro system (with SP4 and all
> latest hotfixes installed).
>
> Running perl -v  I get:
> This is perl, v5.8.0 built for MSWin32-x86-multi-thread
>
> ~~~~~~~~~~~~~~
>
> The problem is I do not get correct result from the following code:
> print <c:\program files\*.*>;
> or
> print <c:\\program files\\*.*>;
>
> I get only one line of output text:
> c:./program
>
> I'm a beginner on Perl, though I've written several scripts
> manipulating Web sites and managing downloads. I wonder if it is a
> bug on Windows system or I'm doing something wrong.

The problem is that the underlying glob() function splits the argument on
whitespace. I was able to get the following working:

   use File::Glob ':glob';
   print bsd_glob('C:\Program Files\*');

See perldoc File::Glob for more details.

This also works, but is not exactly equivalent:

   print <C:\\Program?Files\\*>;

It replaces the space with a ? wildcard character so there's no whitespace.

This also appears to work, but I'm not sure why. Discovered by trial and
error:

   print <C:/Program\\\ Files/*>;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to