in reply to Using perl for refactoring

Well, start by parsing the .pm files for subs and build a list of them, then parse the .pl file looking for the sub names being used.

Even a simple /^\s*sub\s+(\w+)/ match to find the subs would get you 99% of the way there for most purposes. Then assemble a regex to match the sub names you found already and use that to search the main.pl for places the subs are used. Easy peasy.

Perl is the programming world's equivalent of English

Replies are listed 'Best First'.
Re^2: Using perl for refactoring
by Anonymous Monk on Dec 09, 2014 at 11:56 UTC

    sh find $dir -name '*.pm' \ | xargs awk '/^[ \t]*sub[ \t]+[_a-z0-9]+/ { print $2 }' \ | xargs -I % fgrep --word-regexp % *.pm