On Thursday, Nov 6, 2003, at 10:21 US/Pacific, Dan Anderson wrote: [..]

How do I escape spaces? Perldoc glob doesn't say.


[..]

an interesting problem, one thing that may influence
the problem is how your underlying shell does the
'expansion' - as the perldoc -f glob notes, with
perl 5.6 this is resolved with the File::Glob module.

How do you normally escape the spaces when you are at
the shell level??? the '*' solution is basically
cool enough - and yes that with the "bar\ baz" should
have worked as you would have expected it. EXCEPT that
it was inside double quotes, hence would be interpreted
once by perl, which will remove your "\" - so you either
want to go with

        a. print_glob("$dir/foo/bar*baz/*");
        b. print_glob( $dir . '/foo/bar\ baz/*');
        c. print_glob("$dir/foo/bar\\ baz/*");

and resolve who gets to solve which interpolation where.

ciao
drieux

---
a bit of code to illustrate the fun of it all:

        my $dir = <your_path_foo_here>;
        
        print_glob("$dir/foo/bar baz/*");
        print_glob($dir . '/foo/bar baz/*');
        print_glob("$dir/foo/bar\ baz/*");
        print_glob("$dir/foo/bar*baz/*");
        print_glob("$dir/foo/*bar*/*");
        print_glob("$dir/foo/bar' 'baz/*");
        print_glob( $dir . '/foo/bar\ baz/*');
        print_glob("$dir/foo/bar\\ baz/*");
        
        
        #------------------------
        #
        sub print_glob
        {
                my ($tag) = @_;
                
                my @foo = glob $tag;
                print "given :$tag: we see the glob as:\n";
                foreach my $file (@foo)
                {
                        print "\t:$file:\n";
                }
        } # end of print_glob


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



Reply via email to