in reply to Re^2: get file name?
in thread get file name?

Or of course there is split

my $file_name = ( split m{/}, $0 )[-1];
not to mention substr and rindex
my $file_name = substr $0, 1 + rindex $file, '/';
if you insist on regular expressions then this is simpler
my ( $file_name ) = $0 =~ m{([^/]+)$};

If you care about portability, and one day you will, even if its just to port your code back into your brain in six months time, you will stick to Corion's suggested

use File::Basename qw(basename); my $file_name = basename $0;