# you can do this $dir = 'c:\\'; opendir DIR, $dir or die "Can't open $dir perl says $!\n"; while ( $file = readdir DIR ) { next unless $file =~ m/\.txt$/i; print "Found *.txt file: $file\n"; } # or this $dir = 'c:\\'; opendir DIR, $dir or die "Can't open $dir perl says $!\n"; my @files = grep { /\.txt$/i } readdir DIR; print "$_\n" for @files; # or this $dir = "c:\\*.txt"; @files = glob $dir; print "$_\n" for @files;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: open dir
by tachyon
in thread open dir
by dushu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |