in reply to Re^2: recursive directory question
in thread recursive directory question
If any of the file tests (or either the "stat" or "lstat" operators) are given the special filehan- dle consisting of a solitary underline, then the stat structure of the previous file test (or stat operator) is used, saving a system call. (This doesn't work with "-t", and you need to remember that lstat() and "-l" will leave values in the stat structure for the symbolic link, not the real file.) (Also, if the stat buffer was filled by a "lstat" call, "-T" and "-B" will reset it with the results of "stat _"). Example: print "Can do.\n" if -r $a || -w _ || -x _; stat($filename); print "Readable\n" if -r _; print "Writable\n" if -w _; print "Executable\n" if -x _; print "Setuid\n" if -u _; print "Setgid\n" if -g _; print "Sticky\n" if -k _; print "Text\n" if -T _; print "Binary\n" if -B _;
-- Randal L. Schwartz, Perl hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: recursive directory question
by flounder99 (Friar) on Jul 08, 2002 at 13:57 UTC |