On Thu, 12 Dec 2002, Simon Wilcox wrote: > for my $part (@parts) { > next if $part eq $curdir; > if ($part eq $updir) { > die "Can't climb past start" unless (shift @canon);
No. Just shift @canon. /../.. is valid under Unix and it's equal to /. Failure to shift at root doesn't matter. Also you mean pop. Or unshift. Choose. And reverse if appropriate. I suggest push/pop/reverse, it'll be faster than shift/unshift. > }else{ > push @canon, $part; > } > } > > my $canon = File::Spec->catdir( @canon ); > $canon = File::Spec->rel2abs( $canon, $rootdir ) if ( $abs ); > > return $canon; > } S. -- Shevek I am the Borg. sub AUTOLOAD{my$i=$AUTOLOAD;my$x=shift;$i=~s/^.*://;print"$x\n";eval qq{*$AUTOLOAD=sub{my\$x=shift;return unless \$x%$i;&{$x}(\$x);};};} foreach my $i (3..65535) { &{'2'}($i); }