The revision, version, and subversion of the Perl interpreter, represented as a decimal of the form 5.XXXYYY, where XXX is the version / 1e3 and YYY is the subversion / 1e6. For example, Perl v5.10.1 would be "5.010001".
This variable can be used to determine whether the Perl interpreter executing a script is in the right range of versions:
warn "No PerlIO!\n" if $] lt '5.008';
$], string comparison operators are highly recommended. The inherent limitations of binary floating point representation can sometimes lead to incorrect comparisons for some numbers on some architectures.
See also the documentation of
use VERSION and
require VERSION for a convenient way to fail if the running Perl interpreter is too old.
See "$^V" for a representation of the Perl version as a version object, which allows more flexible string comparisons.
The main advantage of
$^V is that it works the same on any version of Perl. The disadvantages are that it can't easily be compared to versions in other formats (e.g. literal v-strings, "v1.2.3" or version objects) and numeric comparisons can occasionally fail; it's good for string literal version checks and bad for comparing to a variable that hasn't been sanity-checked.
$OLD_PERL_VERSION form was added in Perl v5.20.0 for historical reasons but its use is discouraged. (If your reason to use
$] is to run code on old perls then referring to it as
$OLD_PERL_VERSION would be self-defeating.)
Mnemonic: Is this version of perl in the right bracket?