[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [perl] glob() and filenames w/ spaces



On Wed, Apr 25, 2001 at 01:37:39AM +0200, Sven Burgener wrote:
> How do I deal with the situation where glob("*") is used and where there
> are files that contain spaces in their file names?

what "situation"?

    $ touch a\ b c\ d
    $ ls -l
    total 0
    -rw-rw-r--    1 john     john            0 Apr 25 01:25 a b
    -rw-rw-r--    1 john     john            0 Apr 25 01:25 c d
    $ perl -w
    my @files = glob("*");
    foreach my $f (@files)
    {
        open(F, ">$f") or die $!;
        print F "hello\n";
        close F or die $!
    }
    __END__
    $ cat a\ b
    hello

so the problem is...?

-- 
John Lenton (john@grulic.org.ar) -- Random fortune:
When you have to kill a man it costs nothing to be polite.
		-- Winston Churchill, on formal declarations of war

Attachment: pgpDGBHAHW3wf.pgp
Description: PGP signature


Reply to: