in reply to Obtaining perl's version from script
There are several ways to handle the version depending on what you want to do with it. I like to break it up into its components like so:
my ($major, $minor, $patch) = unpack 'CCC', $^V;
If you just want to print it, have a look at the docs for sprintf() and printf(). They support things like:
my $version_string = sprintf "%vd", $^V;
If you want to compare it you can do so directly using Perl's new "vector of ordinal" type strings:
warn "Unsupported version\n" unless $^V ge v5.6.0;
-sauoq "My two cents aren't worth a dime.";
|
|---|