use File::Basename;
use Cwd 'abs_path'; # Get the Absolute path a particular file
my $path = abs_path("../../../japh.pl" );
print "\nabs path : ", $path; # Get the base directory of the file
my $base_dir = dirname($path);
print "\nbase path : ", $base_dir; # Append another one file to the base dir
my $another_file = "$base_dir/myfile";
print "\nAnother file : ", $another_file;
No comments:
Post a Comment