配列じゃなくちゃだめなの?

use File::Basename;
my $filename = basename $0;
とかは?