while($data =~ m/\n\s*(\w+)\s+(.*);/g){ my $typ = $1; print "Test> $typ\n"; my $dat = $2; print "$typ::$dat>>\n"; }