in reply to Combining while statements
What have you tried? In what way does it not work?
Does this do what you mean:
open(TMPFILE,"<page.html") || die "Cant open: $!"; while (<TMPFILE>) { chomp; my $myFile = join('',<TMPFILE>); if ($myFile =~ /'(\d{3})wordONE/){ $data = $1; } if ($myFile =~ /(\d{3})wordTWO/) { $data2 = $1; } } close TMPFILE;
You can combine the two if statements into an if .. elsif to speed things up slightly if you assume that no line will match both your patterns.
Update: While this does combine your two while loops I don't really expect this to do anything sensible (are you sure it works in the version that you had?)
|
|---|