Which version of perl is installed on my system?

Hi,
With the command perl -v i can see the perl version, but it's like a text file..
is there a command which could give me just the perl version number?
i.e.: "5.8.1"

thanks!!

What do you mean "like a text file"? perl -v outputs the version information for the perl that is installed. Output is to stdout. You can capture and parse this data to get the version number if you wish. Post the output of perl -v from your machine.

i wanted to know if there was a way to get te version number without parsing.. i didn't want to do that work

thanks anyways!!

There may be a way but I do not know it off hand. Check the perl man pages or have a look around CPAN or have a look here Perl FAQ

Probably the best way to get the perl version, is with perl itself.

Perl script:

use strict;

$::VERSION = join('.', map {ord} split('', $^V)); 
print $::VERSION

Or as a single command to run in your favourite shell:

perl -Mstrict -wall -e "print join('.', map {ord} split('', \$^V));"

Output (on my system):

5.8.1

See the perlvar man page (for $^V) for further treatment of the subject.

the OP might be looking for perl options like in "uname -r" to get the OS version ... anyways, here's my 2 cents ...

perl -v | awk '/This/ {print $4}' | sed -e 's/v//'
1 Like

Thanks to all of you!!