while(<>) { while(!eof and tr/"// % 2) { $_ .= <>; } # ... do stuff with each record in $_ }