cynba has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I would like to know how to check if a symbolic link is dangling given the filename. I have tried -e. That seems to indicate it exists every time. Any ideas?
  • Comment on Check for whether File is Dangling Symlink

Replies are listed 'Best First'.
Re: Check for whether File is Dangling Symlink
by halfcountplus (Hermit) on Oct 05, 2010 at 18:59 UTC

    You can use readlink to get the file pointed to and test that.

    print "link is good" if (-e readlink($linkname));
      It works! Thank-you!