Help for this page

Select Code to Download


  1. or download this
    my $str = "/One/Two/Three";
    
    my @paths = ($str);
    ...
    push @paths, $str while($str =~ s{^(/.+)/[^/]*$}{$1});
    
    print "$_\n" for @paths;
    
  2. or download this
    /One/Two/Three
    /One/Two
    /One