> >opendir LS, $directory or die "Can't opendir $directory: $!";
> >my @dirs = grep { -d $_ } readdir LS;
> >closedir LS;
> >return @dirs;
> 
> thank you this is much more readable code too me- but i found out that
> you need a fully qualified path...

Right, either that or chdir first before doing the readdir.
 
> my @dirs = grep { -d $_ } readdir LS;
> should be:
> my @dirs = grep { -d "$directory\/$_" } readdir LS;

my @dirs = grep { -d "$directory/$_" } readdir LS;

No need for the backslash before the slash...

> looks like readdir()  is the all around winner :)

Right, anytime you can avoid using system, qx, or `` you'll have a
faster solution.

Luke

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to