in reply to Combining while statements

I don't believe your code is working quite how you think - you're iterating over TMPFILE, then slurping it's contents with the join (which also means you're missing the first line) and then performing a match on that string, repeating the same procedure, and then performing another match on the same string. A simple reduction might look like this (explained below)
open(TMPFILE, "page.html") or die("Can't open page.html: $!") my($data, $data2); { local $/; local $_ = <TMPFILE>; ($data) = /'(\d{3})wordONE/; ($data2) = /(\d{3})wordTWO/; } close(TMPFILE);
That slurps TMPFILE (by undefining $/) into a localised $_ then performs two matches on $_ saving the contents captured in the parentheses into the variables $data and $data2 respectively. This should produce the same (and more reliable) result of the code you demonstrated.
HTH

_________
broquaint