$ perl -MO=Xref,-r tst.pl |grep foo tst.pl (definitions) 1 main & foo subdef tst.pl syntax OK tst.pl (main) 1 main & foo subused tst.pl (main) 4 main & foo subused tst.pl foo 3 main $ _ used $ cat tst.pl foo(); sub foo { print } foo();