in reply to Re: Extract first word from certain lines in a file
in thread Extract first word from certain lines in a file

That is easy:
use strict; while ( <DATA> ) { do {print "\n"; next} if /Product:/; my $firstword=(split " ")[0]; print "$firstword "; } __DATA__ Product: redball This is for Mike. greenball This is for Dave. Product: smallbox This is for apples bigbox This is for orange

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law