Listing all Perl modules in @INC

A commonly asked question by sysadmins is how to list all perl modules – installed and known to perl – on a system.

This is how i do it:

perl -MFile::Find=find -MFile::Spec::Functions -Tlwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC;'

* I took this somewhere from perlmonks a long time ago.