1. Perl
  2. Predefined variable
  3. here

Get the program name $0

Use the predefined variable "$0" to get the program name .

$0;

You can get the name when you started the program. In other words, if you specify a program with an absolute path, you can get the program name with the absolute path name from the current directory, and if you specify it with a relative path, you can get the program name with the relative path name.

If you want to get the name of the directory where the program resides, it is convenient to use FindBin module.

Related Informatrion