On Sunday, November 2, 2003, at 06:19 AM, Rob Dixon wrote:

File::Find would do it for you, but the revursion is very
simple really:

  use strict;
  use warnings;

printdir('/usr');

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.


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.

James


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



Reply via email to