$s{substr($_, 2,index($_,'/',2)-2)}++ for ; print reverse sort map {"$_ = $s{$_}\n"} keys %s; __DATA__ //word.one.team/other.stuff/Info.info //this.sentence/other.inforation/moreInfo //first.part.here/set.list //this.sentence/data/processing