in reply to Many matches to an array
You are missing the /g so you only get one match. You must have missed my Perl Idioms Explained - @ary = $str =~ m/(stuff)/g tutorial :-)
Now even if you had added the /g it would have given you a single match as you are using .+ which is greedy. You need .+? if it is going to work. You should also add /i to make it case insensitive and what about .... type syntax? Where we are heading is the usual suggestion to use HTML::Parser. This should be reasonably reliable, if not best practice.
@divs = $content =~ m!<\s*div[^>]*>(.+?)<\s*/div!sig;
I have posted an HTML::Parser example for you down here
cheers
tachyon
|
|---|