in reply to globing directory names with spaces
Imho glob()bing is ugly anyway. You don't need it. It is much better (again imho) to use grep and readdir, which is also much more portable:
my $dir = shift; my @list = grep /\.java$/ => sub { opendir my $dh => $_[0] or return; my @l = readdir $dh; closedir $dh; return @l }->( $dir ) ;
The subref is of course overhead, but you might want to keep it as named sub for multiple use.
--
|
---|
Replies are listed 'Best First'. | |
---|---|
•Re: Re: globing directory names with spaces
by merlyn (Sage) on Sep 16, 2002 at 15:31 UTC |