Steve Grazzini wrote:
>
> On Sun, Nov 02, 2003 at 05:32:35PM -0600, James Edward Gray II wrote:
> > On Sunday, November 2, 2003, at 06:19 AM, Rob Dixon wrote:
> > >  sub printdir {
> > >
> > >    my $dir = shift;
> > >
> > >    opendir DIR, $dir or die $!;
> > >    my @dirs = grep /[^.]/, readdir DIR;
> >
> > I'm not sure this grep() is what you meant it to be.  It selects any
> > file containing a non-dot character, as written.
>
> Right.  The files to skip are "." (this directory) and ".." (the
> parent directory).  Rob's solution also skips "...", though, so it's
> not perfect.
>
> > I probably would have preferred grep /^[^.]/, ..., which get all
> > files starting with a non-dot character.  I believe that's a little
> > more typical UNIX behavior.
>
> That's fine if you *want* to skip the dotfiles.  But you *always*
> skip "." and "..".  More robust code will also check for cycles, but
> since File::Find does all this already, it's usually better just to
> use the module.

Hi Steve.

Cycles are eliminated by discarding links and printing only directories
and regular files.

/R



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to