Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
        my $str = "/rootdir/sub1/sub2/sub3/sub4";
        print substr($str, 0, rindex($str, "/", length($str) - 2));
    }
    
  2. or download this
    /rootdir/sub1/sub2/sub3
    /rootdir/sub1/sub2/sub3