in reply to Combining while statements

Since you are doing join('',<TMPFILE>);, the whole file is sucked in the the scalar $myFile, so the loop only executes once. Maybe try something like this(untested):
open(TMPFILE,"<page.html") || die "Cant open: $!"; my $myFile = join('', map {chomp;$_} <TMPFILE>); my ($data1, $data2) = $myFile =~ /'(\d{3})wordONE.*?(\d{3})wordTWO/; print "$data1:$data2\n";