On 1/10/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm working on a little script that will generate an html page from a > directory full of symlinks to target directories. However in some > cases there may be symlinks that point to regular files. > > How can perl tell the difference. Or rather how can I test the > symlink to see if it points at a real openable directory. > > Looking through the `stat' function, I'm not imagining a way to get at the > target of the symlink for a test. snip
The -X operators follow the symlink. if (-d $symlink && -r $symlink) { print "$symlink points to a readable directory\n"; print "and you can chdir to it\n" if -x $symlink; } else { print "$symlink is not a directory or it is not readable\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/