The current input file name (if any) lives in $ARGV.
In reply to Re: Finding the name of the current file by Corion in thread Finding the name of the current file by mldvx4