use File::Basename; (my $script = basename $0) =~ s/(\.pl)?$/.cfg/;