# UN-TESTED for { @list ) { next unless m!^//(.*?)/!; $seen{$1}++; } for ( sort keys %seen ) { print "$_ = $seen{$_}\n"; }