I distrust modules? Dunno. I'm a fan of C programming and like doing stuff myself. Granted HTML is free form, but I'm parsing a webpage whose format likely will not change anytime soon, and if it did, even if I was using a module I would still need to fix up the script. I know exactly was format the HTML page will be in, and just need to extract some values from it. The page got a lot of junk before the data, so I need to find a specific pattern and extract data from the next chunk of HTML. Extraction is fairly simple RegEx, so complex modules aren't really required. The flag solution works well. I may take a quick look at the modules... Thanks.
On 4/6/07, Tom Phoenix <[EMAIL PROTECTED]> wrote:
On 4/6/07, yitzle <[EMAIL PROTECTED]> wrote:
snip
Real Perl programmers don't use indices. At least, not like that. But let's say you want to process the lines after a pattern matches, but not the matching line or the ones before. One straightforward way is to set a flag: my $found; # starts out false foreach (@input) { if ($found) { # $_ holds one of the lines you want to process &deal_with($_); } else { # Test $_ for the pattern $found = m/pattern/; } } warn "Hey, pattern never matched" unless $found; snip