in reply to Find the full path of the script at run time
I usually use the below on ActiveState perl. Although I believe it also works on Linux.
use strict; use warnings; use English; use File::Basename qw( dirname ); use File::Spec::Functions qw( rel2abs ); my $script_dir = rel2abs( dirname( $PROGRAM_NAME ) ); print "$script_dir\n";
You could leave out the "use English" and replace $PROGRAM_NAME with $0
You should also look at How do I get the full path to the script executing?
|
|---|