timbu has asked for the wisdom of the Perl Monks concerning the following question:
It doesn't work. I believe this is because stat is not a function, but a unary operator which doesn't set a return value.
But ... ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize,$blocks) = stat($file) or print "ERROR: $filename had error: $!\n";
... mostly works. It never will print "Error ....
Can some explain to me what Perl trickery makes it work with 'or' and not with '||'? I assume is has something to do with precedence of the =,||,or, and stat operators.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: stat question
by Sidhekin (Priest) on Apr 25, 2002 at 20:03 UTC | |
|
Re: stat question
by particle (Vicar) on Apr 25, 2002 at 19:43 UTC | |
by timbu (Novice) on Apr 25, 2002 at 20:12 UTC | |
by Sidhekin (Priest) on Apr 25, 2002 at 20:35 UTC |