in reply to Re: globing directory names with spaces
in thread globing directory names with spaces
The subref is of course overhead, but you might want to keep it as named sub for multiple use.Or just eliminate it entirely using a do-block instead of indirecting it with a subroutine:
my $dir = shift; my @list = grep /\.java$/ , do { if (opendir my $dh, $dir) { my @l = readdir $dh; closedir $dh; @l; } else { () } };
-- Randal L. Schwartz, Perl hacker
|
|---|