in reply to Re: Cleaning up a path
in thread Cleaning up a path
#!/usr/bin/perl use strict; use warnings; use File::Spec; my $somepath = "/var/log/../../home/poletti/../../etc/rc.d"; my @true; $somepath = "/../../../"; # Let's pretend $somepath is a directory... or is it? :) /^\.\./ ? pop( @true ) : push( @true, $_ ) foreach( File::Spec->splitdir($somepath) ); print File::Spec->catdir(@true), "\n";
Flavio (perl -e "print(scalar(reverse('ti.xittelop@oivalf')))")
Don't fool yourself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Cleaning up a path
by ikegami (Patriarch) on Apr 13, 2005 at 18:03 UTC | |
by polettix (Vicar) on Apr 13, 2005 at 18:14 UTC | |
by ikegami (Patriarch) on Apr 13, 2005 at 18:28 UTC |