in reply to Re: Hi Monks could you pls help Perl dummy user
in thread Hi Monks could you pls help Perl dummy user

while ( my $file = readdir $dh ) {
Come to think of it, should probably be
while ( defined( my $file = readdir $dh ) ) {

Replies are listed 'Best First'.
Re^3: Hi Monks could you pls help Perl dummy user
by Anonymous Monk on Dec 17, 2014 at 11:03 UTC
    No no, it has to have five defined , like this
    while ( defined defined defined defined defined( my $file = readdir $d +h ) ) {
      Mmmm, I thought only readline is special-cased. Who can remember all this ****.

        Mmmm, I thought only readline is special-cased. Who can remember all this ****.

        :/

        $ perl -MO=Deparse -le " while( my $f = readdir $DIR ){ print $f; } " BEGIN { $/ = "\n"; $\ = "\n"; } while (defined(my $f = readdir $DIR)) { do { print $f }; } -e syntax OK