Perl: Print Version String from Script

By Xah Lee. Date: . Last updated: .

Print version from the command line:

perl -v

Print version from within a script:

print $^V;
# v5.32.1

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.

perldoc perlvar

perl versions