You are viewing the version of this documentation from Perl 5.8.5. View the latest version
$PERL_VERSION
$^V

The revision, version, and subversion of the Perl interpreter, represented as a string composed of characters with those ordinals. Thus in Perl v5.6.0 it equals chr(5) . chr(6) . chr(0) and will return true for $^V eq v5.6.0. Note that the characters in this string value can potentially be in Unicode range.

This can be used to determine whether the Perl interpreter executing a script is in the right range of versions. (Mnemonic: use ^V for Version Control.) Example:

warn "No \"our\" declarations!\n" if $^V and $^V lt v5.6.0;

To convert $^V into its string representation use sprintf()'s "%vd" conversion:

printf "version is v%vd\n", $^V;  # Perl's version

See the documentation of use VERSION and require VERSION for a convenient way to fail if the running Perl interpreter is too old.

See also $] for an older representation of the Perl version.