use Cwd qw(abs_path); use File::Basename; my $dir = dirname(abs_path($0)); print "$dir\n";