Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
how to get perl file soucre file name in perl program?
e.g. if my source file name is perl1.pl,I want my code to fetch this name with full path in some variable
THIS IS NOT FOR CGI PROGRAMMING SO DONT TELL ME TO USE ENVIRONMENT VARIABLES
THANKS
2 Answers
- 1 decade agoFavorite Answer
I wont write out the script for you but the only idea that comes to mind is to use $$ (pid of this process) to find the line from a ps -aux command .corresponding to the running process THe last part of that line listing should give the name of the perl file running.
- martinthurnLv 61 decade ago
$0 (that's dollar zero) is supposed to give you that info, but it may vary slightly, depending on how exactly you call the program (and of course it depends on your OS)... Try it!
Source(s): C:\> perldoc perlvar