XP is just a number | |
PerlMonks |
Loop behavior with HTML::TokeParser::Simpleby WhiteBird (Hermit) |
on Dec 20, 2003 at 02:09 UTC ( [id://315971]=perlquestion: print w/replies, xml ) | Need Help?? |
WhiteBird has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed Monks:
I'm having a difficulty with a snippet of code. The larger context requires that I replace one image link embedded deep inside each of over 100 HTML recipe files. The current link in each document is a relative link and each image has a different, unknown ID number as such: The replacement string is constructed of a title gleaned from the title of the recipe and munged into a proper HTML format. I've built code that gets the title and gets to the image tag. I just can't seem to get the regex replacement to work correctly. The relevent snippet is this:
There are two other image references after the one I'm interested in and the looping picks through all of them. (At this point, that's not a problem.) When I run the script on a file, my printed debugging output is this:
Why is the first tag missed in the replacement step and the following two work correctly? I keep looking at it and I suspect it's something obvious in the structure of the code, but I am out of ideas. Help?
Back to
Seekers of Perl Wisdom
|
|