open(TMPFILE,"); my ($data1, $data2) = $myFile =~ /'(\d{3})wordONE.*?(\d{3})wordTWO/; print "$data1:$data2\n";