On Sun, 13 Mar 2016 09:48:20 -0500
Mike Flannigan <mikef...@att.net> wrote:

> 
> FYI, there is no error.  If the directory
> path has no spaces it works fine, if the directory
> path has spaces it prints the path up to the 1st space
> and just goes back to a cursor line.
> 
> 
> Mike

Yup. The default glob() function s based on the C-shell and spaces are
separators. If your file names have spaces, use the BSD glob. This will
replace glob() with one that allows spaces in the file names.

    use File::Glob qw( :bsd_glob );

> 
> 
> On 3/6/2016 5:04 AM, beginners-digest-h...@perl.org wrote:
> > Subject:
> > Re: reading directories using perl in windows
> > From:
> > Akshay Mohit <akshaymohit2...@gmail.com>
> > Date:
> > 3/1/2016 4:49 AM
> >
> > To:
> > Arghya Das <arghya0...@gmail.com>
> > CC:
> > Perl Beginners <beginners@perl.org>
> >
> >
> > Could you please send the exact error which you are getting as I 
> > Copy/Pasted the exact code which you had given and it is working 
> > properly for me. I have only given the directory which is present
> > in my system.
> >
> > use strict;
> > use warnings;
> >
> > my $dir = "C:/Python_Exercise/*";
> > my @files = glob( $dir );
> >
> > foreach (@files ){
> >    print $_ . "\n";
> > }
> 



-- 
Don't stop where the ink does.
        Shawn

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to