in reply to Combining while statements

Your while loops are oddly constructed. You are discarding the first line after chomping it and then slurping the rest. Each while loop only runs once.

Do you mean to do something like this?

open TMPFILE, "< page.html" or die "Cant open: ", $!; my (@data, @data2); while (<TMPFILE>) { push @data, $1 if /'(\d{3})wordONE/; push @data2, $1 if /(\d{3})wordTWO/; } close TMPFILE;
I'm made suspicious by your doing this on an html file. Are you doing something better handled by some HTML::Parser module?

(Added) Thanks, jeffa, for spotting a typo in the code. Repaired.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Combining while statements
by Anonymous Monk on Jun 17, 2003 at 15:09 UTC
    Thanks for all the responses. I used "join" because I was fetching something that covered two lines. I will now try all your suggestions.