I'm working on converting Perl cgi script to Python.
Inside the script, I'm came across this below code which I didn't understand.
Help me figure this out.
my $p = $0;
$p =~ s|.*/||;
I understood that my $p = $0;
assigns the absolute path+name of the script file to variable p.
and the second line is going to perform regex substitution and give only the file name without path.
But what I didn't understand are those |.*/||
after s
.
I searched many resources but didn't understand what it does.
What are those things actually going to do to give me only the script name?