Since no one seems to have mentioned it so far...
The basic problem here is greedy matching. The ".*
" is a greedy match so "m%(<a href="http://dynamodata.*/a>)%g
" will match exactly once, with ".*
" matching everything between the first occurrence of "<a href="http://dynamodata
" and the last
occurrence of "/a>
". If, as in this case, you want to match the first
following occurrence of "/a>
" you can use the non-greedy form ".*?
@tags = $content =~ m%(<a href="http://dynamodata.*?/a>)%g;
should work (not tested, since I'm not at the right machine at the moment....)