Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: HTML tag extraction probs...

by benn (Priest)
on Aug 07, 2003 at 13:56 UTC ( #281894=note: print w/ replies, xml ) Need Help??

in reply to Global symbol probs...

The error means exactly what it'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...

@htmlLines = map {s/your_regex//ig;$_;} @htmlLines

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.

Comment on Re: HTML tag extraction probs...
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://281894]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2015-11-28 06:56 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (739 votes), past polls