in reply to negative look ahead

You can do this without an assertion by making the regex not greedy:

($match) = $str =~ /<sec>(.*?)<pg>/;

Try perldoc.com and look at the POD "perlre" for some information about lookaheads and behinds. They're neat, but a lot of times they can be avoided by rethinking what you're searching for.