You should only use a solution like that if you know that there won't be a line break in the tag and you know the src attribute is always going to be the first one. I.e., neither of the following will work:
If you're going to be parsing pages written by others, try using a module like HTML::TokeParser::Simple, which makes it extremely easy to extract the src attribute from all <img> tags:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.