in reply to How to obtain current working directory
I assume You want your current path and NOT you currently executing program.#!/usr/bin/perl use strict; use File::Spec; print "File::Spec::VERSION ", $File::Spec::VERSION, "\n"; # looking for our scripts directory my $fullprogram = $0; my (undef,undef,$program) = File::Spec->splitpath( $fullprogram ); print $fullprogram, "\n"; print $program, "\n"; # looking for current position my $cur_dir = File::Spec->curdir(); print $cur_dir, "\n"; my $abs_path = File::Spec->rel2abs( $cur_dir ) ; print $abs_path, "\n";
|
|---|