use strict; use warnings; use Cwd 'abs_path'; use File::Basename; my $script_dirname = dirname(abs_path($0)); print "dirname: $script_dirname\n";