An easy way is to split on '/' which ordinarily needs to be escaped. The resulting array has nothing in the first two slots,
my %count; $count{(split /\//)[2]}++ while <DATA>; printf "%s = %d\n", $_, $count{$_} for keys %count; __DATA__ //word.one.team/other.stuff/Info.info //this.sentence/other.inforation/moreInfo //first.part.here/set.list //this.sentence/data/processing
Update: ++tos for the correction. Repaired.
After Compline,
Zaxo
In reply to Re: Extract info from a list
by Zaxo
in thread Extract info from a list
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |