Your question has been directly answered, but there is a major pitfall to your approach. Even using the non-greedy match, you will run into problems with nested tags. Example:
$input = '<foo>bar<foo>oops</foo></foo>';
print $input =~ m{<foo>(.*?)</foo>}, "\n";
__OUTPUT__
bar<foo>oops
This is one big reason you should avoid simple regular expressions for parsing nested formats, like HTML. The best solution is to use a real parser that actually understands its source data, rather than simple pattern matches.