Use the
g regex modifier to capture all the pairs. Count them and see how many you have. Then decide. Use the non-capturing parenthesis
(?: ) for the space. This still leaves a lot of questions - e.g. what to with character
triples?
while (<>){
my @charpairs = /(?: \s+ (\w\w) ) /gx;
if($charpairs != 4){
print "Funny looking at line $. :\n\t'$_'\n"}
else{
#do smthing
}}
throop