http://qs321.pair.com?node_id=242532

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

Hello fellow monks!

How would I find the full path to a script at the time it is invoked? eg, if the script is /home/foo/script.pl, return all of that.

I need this to work on Win32 also. I'm about to go dive into perlvar and see if I can find a built-in that does this, but I thought I'd ask my wise masters first. :-)

Cheers,
ibanix

$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;