Quick way to find out the version number of an installed Perl module in Linux/Solaris OS

Perl module features and behavior can change from version to version and so knowing the version number of an installed Perl module can be useful in several scenarios.
Below is the command line methods for finding out the version number of an installed module in Linux/Oracle Solaris OS.

perl -M<PerlModuleName> -e 'print $ <PerlModuleName>::VERSION ."\n";'

example:

[root @ unixonline]~ # perl -MCrypt::CBC -e 'print $ Crypt::CBC::VERSION ."\n";'
2.33

or you can do it in this lazy way:

perl -M<PerlModuleName>\ 9999

example:

[root @ unixonline]~ # perl -MCrypt::CBC\ 9999
Crypt::CBC version 9999 required--this is only version 2.33.
BEGIN failed--compilation aborted.

For finding list of installed Perl modules in Linux/Solaris OS, please refer to instmodsh – A shell script to examine/list installed Perl modules in Linux/Solaris OS.

Leave a Comment