How can I check that a perl version is not greater than some value?

perl

Solution

This code will die if the version of Perl is greater than 5.8.9:

die "woah, that is a little too new" unless $] <= 5.008009;

You can read more about `$]` in `perldoc perlvar`.

Problem

To ensure a script has at least version X of perl, you can do the following ``` require 5.6.8; ``` What is the best way of checking that a version is not too recent? (i.e. version 5.8.x if fine, but 5.9 or 5.10 are not ok).

Original source