in reply to Absolute pathnames from relative?
but I couldn't find it either. Of course, we could transform the for loop into a map, go on a quest, and golf it!my $fn= File::Spec->rel2abs("../bin/fnurgle","/usr/local/bin"); print "Before: $fn\n"; for (File::Spec->splitdir($fn)) { if ($_ ne "..") { push @arr, $_ } else { pop @arr } } print "After: ",File::Spec->catdir(@arr),"\n";
It should work perfectly the first time! - toma
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Absolute pathnames from relative?
by PodMaster (Abbot) on Jun 09, 2004 at 20:38 UTC |