How to check perl module version

From Svendsen Tech PowerShell Wiki
Jump to: navigation, search

Finding Out Which Version of a Perl Module You Have

Usually, a module will have a $VERSION variable, so the below will work. If it doesn't, you're out of luck.

Linux Output Example

$ perl -le 'use IO::Socket; print $IO::Socket::VERSION'

You can also use the -MModule::Name parameter to the perl executable rather than a use statement:

$ perl -MIO::Socket -le 'print $IO::Socket::VERSION'

Windows Output Example

From PowerShell:

PS C:\> perl -le 'use IO::Socket; print $IO::Socket::VERSION'

From cmd.exe:

E:\>perl -MIO::Socket -e "print $IO::Socket::VERSION"

Read more about Perl from PowerShell and cmd.exe here.

Finding Out Which Version of Perl Itself You Have

The command perl -v should tell you:

$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at, the Perl Home Page.

Or you can print the special $] variable in a one-liner:

$ perl -le 'print $]'