in reply to Getting the name of the file passed as STDIN from /bin/env?

The OS will call

exec('/bin/env', '/home/weigand/perl_wrapper.pl', '/home/weigand/tmp.p +l')

env will call

exec('/home/weigand/perl_wrapper.pl', '/home/weigand/tmp.pl')

The OS will call

exec('/usr/bin/perl', '/home/weigand/perl_wrapper.pl', '/home/weigand/ +tmp.pl')

So $ARGV[0].

The funny part: It's /usr/bin/env on my system. To be portable, you'd have to use env to find env :)

Replies are listed 'Best First'.
Re^2: Getting the name of the file passed as STDIN from /bin/env?
by weigand (Initiate) on Mar 16, 2011 at 21:02 UTC

    You're right! Haha. For some reason I thought it wasn't passed in $ARGV[0]. I think I was looking at $0 instead. Thank you thank you!