in reply to Is this the time for a negative lookbehind?

I can't figure out how to ignore commented lines. I've been trying to figure out negative lookbehinds, cause that seems to be the thing to do.

The lookbehind you show is for the string "!-". Looks like you might be confusing HTML comments for Perl ones.

I don't think you need a lookbehind.   m,^[^#]*(use|require)\s+([\w:]+)\s*[^;]*;,igm should do the trick. I added the 'm' modifier so that ^ would match inside of a string, and removed the 's' modifier so that '.' wouldn't match \n.

Note that won't correctly handle   require 5.003; If that matters, the change is left as an exercise.