in reply to Re: 2 sed problems
in thread Yet another substitution problem

If the original path started out with ../, program will die too soon for no good reason. In this case, ../ should be preserved.

Replies are listed 'Best First'.
Re^3: 2 sed problems
by graff (Chancellor) on Mar 28, 2009 at 16:33 UTC
    Yup, good point. And the best way to fix it would be to "use Cwd", which makes all that code unnecessary anyway:
    #!/usr/bin/perl use Cwd qw/abs_path/; print abs_path( $_ ) for ( @ARGV );
    That prints an empty string (no error message) whenever any non-final path component is non-existent or unreadable (due to permissions).