I have a path like
"/root/Tools/Log/../../Bin2/Patch/../Settings/ServerInfo/", and it's
absolute path should be "/root/Bin2/Settings/ServerInfo".
and I use these codes to get what I want.

my $my_str = "/root/Tools/Log/../../Bin2/Patch/../Settings/ServerInfo/";
Replace_it: $my_str =~ s#[^\./]+/\.\./##g
and goto Replace_it;
print $my_str . "\n";

Does anyone has a better idea?



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to