I have Perl script and need to determine the full path and filename of the script during execution. I discovered that depending on how you call the script $0 va
$0
Are you looking for this?:
my $thisfile = $1 if $0 =~ /\\([^\\]*)$|\/([^\/]*)$/; print "You are running $thisfile now.\n";
The output will look like this:
You are running MyFileName.pl now.
It works on both Windows and Unix.