Help for this page

Select Code to Download


  1. or download this
    sub path_parts(@) { shift=~m((/[^/]*))g }
    sub limit_list($@) { $#_=-1+shift; @_ }
    
  2. or download this
    my $orig_path = "/a/b/c/d/e/f";
    my $trunc_path = join '', limit_list( 3, path_parts( $orig_path ) );