|
|
OverviewRecognize file name as script name and use it as $script in the script and use it in whereever in the script.
Flow
A sample codeuse File::Basename; my $script = basename($0);
Description of the codeuse File::Basename; Load File::Basename; my $script = basename($0); When the perl command is executed, $0 contains the script name itself. By using basename method, it extracts command name only. i.e. exclude the path name. As a result, $script will have the script name only. |