use File::Spec::Functions qw( rel2abs splitpath catpath ); my $RealBin = catpath( (splitpath rel2abs($0))[0,1] );