in reply to Normalized directory paths

How about this:
# Prepend $pwd as necessary @p=(); foreach (split("/", $path)) { pop @p, next if $_ eq '..'; next if $_ eq '.'; push @p, $_; } $path=join("/", @p);
It is clearer, in my opinion, but considerably slower:
Benchmark: timing 1000 iterations of Mikfire, Zamboni... Mikfire: 1 wallclock secs ( 0.47 usr + 0.00 sys = 0.47 CPU) Zamboni: 4 wallclock secs ( 3.23 usr + 0.00 sys = 3.23 CPU)
As given, your last solution produces double diagonals sometimes. For the string '/home/zamboni/tmp/../lib/./tex/..' it produces '/home/zamboni//lib//'. The solution is to match a second optional diagonal after the (\.)?, like this:
while ( $path =~ s#(/[^/]+)?/\.(\.)?/?#defined($2) ? "/" : "$1/"#e ) { +;}

--ZZamboni