in reply to Combining while statements
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.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);
_________
broquaint
|
|---|