in reply to Re: How to get a true canonical path
in thread How to get a true canonical path
use strict; use Cwd 'abs_path'; my $fileinquestion = "/var/mail/"; my $realpathfor = abs_path($fileinquestion); print "$realpathfor\n";
is pretty realpwd -P
#!perl use strict; use Cwd; use Cwd 'abs_path'; my $q = 'C:\\TEMP\\'; chdir $q; my $dirnow = getcwd(); print "Changed dir to C:\\TEMP\n"; print "Cwd thinks I am in $dirnow\n"; chdir "..\\"; print "Changed dir up one level ..\n"; my $newdirnow = getcwd(); print "Cwd now thinks I am in $newdirnow\n";
|
|---|