the default Perl version installed on my machine is the 5.8.7. When I run my script internally switch to another perl version (v5.10.1) doing this:
my $perl_5_10 = "/opt/perl_5.10.1/bin";
$ENV{'PATH'} = $perl_5_10 ":" . $ENV{'PATH'};
Now, I have to check the perl version, and I do:
## PERL: need perl version >= 5.10!
if ($] < 5.010000)
{
## VERSION ERROR!
}
my $perl_cmd = "perl --version";
my $perl_str=`$perl_cmd`;
print "PERL VERSION = " . $perl_str; ## this clearly print 5.10.1
it return error as the version used is 5.8.7 and that's pretty normal as I ran my script with that version. But my problem is:
how can I check that the new perl version is >= 5.10.1 ?