Re: Change relative path to absolute path

2012-05-11 Thread Magnus Woldrich
On May 11, Zapp (Zapp) wrote: Does anyone has a better idea? #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use Cwd qw(getcwd); my $cwd = getcwd(); print map { -e "$cwd/$_" ? "$cwd/$_\n" : "$_\n" } @ARGV; Or use rel2abs in the core File::Spec module. -- Magnus Woldrich

Re: Change relative path to absolute path

2012-05-11 Thread Shawn H Corey
On 12-05-11 05:14 AM, Zapp wrote: > Does anyone has a better idea? Yes, use Cwd::realpath() See `perldoc Cwd` for details. -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. [updated for today's programming]

Change relative path to absolute path

2012-05-11 Thread Zapp
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#[^\./]+/\.\.