CODE:
[code language=”perl”]
use File::Basename;
my $progname = basename($0);
$progname =~ m/(.*)(\.)(.*)/;
print "Script name along with extension: [$progname]\n";
print "Script name without extension: [$1]\n";
[/code]
OUTPUT:
[code language=”perl”]
C:\>perl get-script-name.pl
Script name along with extension: [get-script-name.pl]
Script name without extension: [get-script-name]
C:\>
[/code]