while () { for my $myword (split){ if ($/ eq "\n") { #do stuff } #do more stuff } }