Perl: Print Version String from Script

By Xah Lee. Date: . Last updated: .

Print version from the command line:

perl --version

Print version from within a script:

#-*- coding: utf-8 -*-
# perl

# prints version string
print $^V;                      # sample output: v5.14.2

Printing version from script is a important technique to find out which version your script is running. Because, you might have several version installed, and in terminal, there are aliases, links, path environment variables, various shell init scripts, that effect which Perl version will start when you type perl in shell.

Show Perl Version History

Type perldoc perlhist to list perl release history.

perldoc perlvar