[root@smart sporty]# pwd
/root/sporty
[root@smart sporty]# cat uhuh.pl
#!/usr/bin/perl
print "$0 does not know\n", `pwd`;
[root@smart sporty]# ./uhuh.pl
./uhuh.pl does not know
/root/sporty
[root@smart sporty]# perl uhuh.pl
uhuh.pl does not know
/root/sporty
[root@smart sporty]#
If you aren't in that directory where it was run, cwd fails miserably.
And if (you) don't call the script with /full/path/to/script.pl then $0 has little to offer....
|