in reply to Unable to resolve links...

First,welcome to Perl Monks!

Second, you are much more likely to get enthusiastic help if you surround your code with code tags (<code>....</code>). That way you can preserve all of the indenting in your original code.

use strict; use Cwd 'abs_path'; use File::Spec::Link; use vars qw ($LIST_SEPARATOR); my $path = "/home/czechar/foo/bar/myfile.xml"; print STDOUT "Original path: $path\n"; my $new_path = File::Spec::Link->resolve_all($path); print STDOUT "Resolved path(1): $new_path\n"; my $abs_path = abs_path($path); print STDOUT "Resolved path(2): $abs_path\n"; # # now try to read from a file... # open (FILE_LIST, "< ./filenames"); my $path = <FILE_LIST>; chomp $path; print STDOUT "path from file: $path\n"; $abs_path = abs_path($path); print STDOUT "abs path: $abs_path\n"; $new_path = File::Spec::Link->resolve_all($path); print STDOUT "new path: $new_path\n"; close (FILE_LIST); exit;
Now isn't that MUCH easier to read? :-) Here's how to do it:
My code: <code> [ cut and paste your code here ] </code>

As for the bug and tracking down its causes:

Note: Please don't rely on my formatting above in lieu of fixing your original post. People may not take the time to look at the replies if they see your original post has no formatting. To edit and save changes, click on your original post, scroll down below to see the text box (make changes there), scroll down below the text box to see the update button (click to save). Thanks!

Best, beth

Replies are listed 'Best First'.
Re^2: Unable to resolve links...
by czech (Sexton) on Nov 05, 2010 at 19:23 UTC
    Hi Beth - Thanks for the pointer about <code> tags. You were right about the whitespace. I had a single whitespace character - a space - that screwed up abs_path and resolve_all, resolve_path, etc. And thanks for the tip about printing debug output to STDERR instead of STDOUT. You rock!