Just use:
if ( -l "$ENV{MYHOME}/link" ) { unlink "$ENV{MYHOME}/link" or die "Failed to remove file $ENV{MYHOME}/link: $!\n"; }
If the communication failure goes off, he will say why. -l asks if the target is a link. -e asks if the file exists. If your link is linked to a non-existent file, it will return false, and your code will not be able to delete the link.
unpythonic
source share