> I have a path, say "dira/dirb/../dirc/file" and I want to 
> collapse it to a canonical path "dira/dirc/file". 

You could always cheat.

    use Cwd;

    sub canon_path {
        my $path = shift;
        my $old_wd = cwd();
        chdir $path;
        my $cpath = cwd();
        chdir $old_cwd;
        return $cpath;
    }
        
Sprinkle with error checking for things like non-existent directories,
or directories you can't chdir into as necessary.

N
-- 
1        1         2         3         4         5         6         7    7
         0         0         0         0         0         0         0    5
  -- The 75 column-ometer
                                             Contributing to the heat death
Global Messaging, 120 Cheapside, x83331      of the universe since 1973.

Reply via email to