On Sun, 13 Mar 2016 09:48:20 -0500
Mike Flannigan <[email protected]> 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, [email protected] wrote:
> > Subject:
> > Re: reading directories using perl in windows
> > From:
> > Akshay Mohit <[email protected]>
> > Date:
> > 3/1/2016 4:49 AM
> >
> > To:
> > Arghya Das <[email protected]>
> > CC:
> > Perl Beginners <[email protected]>
> >
> >
> > 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: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/