http://www.perlmonks.org?node_id=976771

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

Monks,

I'm checking the return code of symlink using the following code. But, it is not reporting any error if source link is not existing. Is there any better way of handling this?

use strict; my ($link1, $link2); # source $link1 = '/var/tmp/sample.txt; #destination $link2 = '/tmp/sample.txt'; my $stat = symlink("$link1", "$link2"); if ( $stat ) { print "Link got created \n"; } else { print "Link not created \n"; }