while( <> ) { print "$string was encountered $repitition times.\n" if /$string+/g; }