#!/usr/bin/perl -w use strict; my $bit="ace"; my (%hash); while () { while($_ =~ /$bit/g) { $hash{$_}++; } }