in reply to Cleaning up a path
According to the docs:#!/usr/bin/perl use strict; use warnings; use Cwd 'abs_path'; my $somepath = "/var/log/../../home/poletti/../../etc/passwd"; print "starting path: [$somepath]\n"; print "abs_path : [", abs_path($somepath), "]\n" __END__ starting path: [/var/log/../../home/poletti/../../etc/passwd] abs_path : [/etc/passwd]
This probably requires that the file actually lives in the filesystem, but most of the time it's what one wants. Thank you all for the contributions, anyway :)abs_path my $abs_path = abs_path($file); Uses the same algorithm as getcwd(). Symbolic links and re +lative- path components ("." and "..") are resolved to return the c +anonical pathname, just like realpath(3).
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|