No, it's impossible. You can't parse an arbitrary Perl program statically and assign meaning to every token. I've demonstrated that here in my now famous "
On Parsing Perl" note. You can get
arbitrarily close but there will always be that gap.
-- Randal L. Schwartz, Perl hacker