I was going to propose a very similar angle, only I'd use B::Xref as it does 90% of what you need for this job. Its output is also more consistent and easier to parse for as this task.
Makeshifts last the longest.
Comment on Re^2: Check a perl script for repeat "my" declarations (use B::Xref)