use warnings; use strict; while () { print if ((grep /r/, split //) == 4); } __DATA__ r 3 r r rr 4 r r r r nada nothing zilch to many rr rrrr rrr 's