The $] variable is deprecated in favor of the $^V variable , which contains the version of the current Perl interpreter as version (or undef if the version is higher than v5.6).
This allows you to compare the version with a string constant, for example v5.10 , which creates a packed string (containing the serial number of each version as a character code, so v5.10 eq "\x05\x0A" true).
Since v-strings are strings, you should compare them with the string comparators lt , le , eq , ge and gt , so you should write something like
use v5.6; if ( $^V ge v5.10 ) { ... }
But I wonder how your code will alternate between different versions of Perl? Most of the changes are syntactic, which offer a more convenient way to write certain constructs. Usually, you only need to write for the earliest version you want to support. It used to be v5.8, but v5.10 was a major revision, and many people assume that this is the minimum version required now that it is seven years old.
source share