[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-beginners
Subject:    Re: $File::Find and no_chdir
From:       85.144.210.174
Date:       2007-09-29 17:26:02
Message-ID: 20070929172733.1339.qmail () lists ! develooper ! com
[Download RAW message or body]

schms schreef:

> opendir DH, $DIR or die "Cannot open '$DIR' $!";
> print map "$DIR/$_\n", readdir DH;
> closedir DH;

Looks very 'global variables' oriented to me. 

Compare to:

  {   opendir my $dh, $dir
          or die "Cannot open '$dir': $!";

      while (my $e = readdir $dh) {
          $e = "$dir/$e";
          -d $e and $e .= "/\t<--";
          print "$e\n";
      }
      closedir $dh;  #  no need, is implicit
  }

-- 
Affijn, Ruud

"Gewoon is een tijger."

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic