use strict; while(){ chomp; print "IN:$&\n" if($_ =~/\s[^\s]+\s[^\s]+$/); }