Help for this page

Select Code to Download


  1. or download this
    do
    {   
        # your stuff here
        print "\t\t$path\n";
    } while $path =~ s#(?:(^/)|/)[^/]+$#$1?$1:''#e;
    
  2. or download this
    sub pathtrim {
        my ($path) = @_;
        return '/' if ($path =~ m#^/[^/]+$/);
        $path =~ s#/[^/]+$##;
        return $path;
    }