in reply to Extract info from a list
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Extract info from a list
by tos (Deacon) on Jul 16, 2003 at 09:24 UTC |