Phoenix.pm: Glob limit
Giffin Ron-P08295
Ron.Giffin at motorola.com
Fri Oct 22 17:46:46 CDT 1999
Thanx Kevin. Works great. Just what I wanted.
-----Original Message-----
From: Kevin Buettner [mailto:kev at primenet.com]
Sent: Friday, October 22, 1999 3:21 PM
To: phoenix-pm-list at happyfunball.pm.org
Subject: Re: Phoenix.pm: Glob limit
On Oct 22, 3:06pm, Giffin Ron-P08295 wrote:
> I don't believe opendir,... will help. I get the errors when I
> use the unix wildcard * IE:
> @files = `ls *.dat` ; or @files = glob ( "*.dat" ) ; or even
> foreach $file ( <*.dat> ) { ... } I will look at file::find.
I did say I was partial to File::Find, but in this case opendir/
readdir/closedir might be better. (Unless you need to traverse
a directory structure in which case File::Find would probably be
better.)
Try this:
--- test-opendir.pl ---
#!/usr/bin/perl -w
opendir DIR, '.' or die "Can't open .: $!";
@files = grep /.dat$/, readdir DIR;
closedir DIR or die "Can't close .: $!";
print join "\n", sort @files;
print "\n";
--- end test-opendir.pl ---
--
Kevin Buettner
kev at primenet.com, kevinb at cygnus.com
More information about the Phoenix-pm
mailing list