Problems? Is your data what you think it is? | |
PerlMonks |
Re: HTML tag extraction probs...by benn (Vicar) |
on Aug 07, 2003 at 13:56 UTC ( [id://281894]=note: print w/replies, xml ) | Need Help?? |
The error means exactly what it says...you're using $i in scrapTag without declaring it. There are fixes for your existing code, but I'd probably rewrite the sub simply as a map - something like...
There's no need for a sub here at all - if you want to do many 'scrapTags', then by all means declare one, but you'll maybe want to pass in your '@htmlLines', rather than relying on a global. As for the regex...that's fine so long as your img tags don't have any ">" characters (say, <img src='next_page' alt='>'> <img src='last_page' alt='>>'>, which is something I tend to do a fair amount) - check out the many HTML parsing modules that are mentioned here 10 or 20 times a day :) Cheers, Ben.
In Section
Seekers of Perl Wisdom
|
|