This reply is very late, but I think needs adding. rel2abs($0)
will probably break if you are running setuid on a modern Unix. To avoid a race condition, these kernels do not pass the filename of a setuid script to its interpreter but rather a "virtual" filename (somewhere in /proc
on Linux if I'm not mistaken) which is rigidly associated to the file the kernel opened. The filename Perl sees in that case and consequently the $0
value would bear no relation to the actual location of the script. (Of course, FindBin will not work any better in that case.)
Makeshifts last the longest.