I want to find out the current directory of the perl script I'm in e.g
use Cwd;
print cwd()."\n";
However, the above code tells you where the script is being executed from so
# /usr/local/src/perl/> perl test.pl
/usr/local/src/perl
works fine and dandy but this isn't so good
# /home/foobar/> perl /usr/local/src/perl/test.pl
/home/foobar
as I still want to get
/usr/local/src/perl as that's where it lives.
Is there a nice perl-y way of doing this? Or am I going to have to resort to the dark arts of 'nasty hacking'?
broquaint