while ($string=) { if ($string=~ /^FIELD/) { while($line=) { last if $line =~ /^\);$/; } } else { @lines=split(/\s+/,$string); print "@lines\n"; } }