If you're wanting to ensure that your code will run on perl-5.8.4 then it's
best to actually test the code on perl-5.8.4.
If code that contains "use 5.008_004" runs fine on perl-5.10.0 (as would
generally be the case), there's no guarantee that it will run ok on
perl-5.8.4.

For example, this script:

use strict;
use warnings;
use 5.008_004;
my $x = 5;
my $y //= $x;
print $y;

runs fine on perl-5.10.0, where it outputs "5" - but on perl.008_004 it
simply outputs the error message:

Search pattern not terminated at try.pl line 5.

This is because perl-5.8.4 (along with all other pre 5.10.0 releases) does
not understand the //= (defined-or) operator which was introduced in
perl-5.10.0.

AFAIK, the only surefire method of catching such an incompatibility is to
run the code on perl-5.8.4 and see how it fares.

Cheers,
Rob





On Sat, Dec 22, 2018 at 10:04 PM Leam Hall <leamh...@gmail.com> wrote:

> Ah, so if the node has perl 5.8.4 and I use a code construct that came in
> 5.10, my code will fail?
>
> I thought the "use" precluded me from using later code constructs. Drat,
> now I have to figure out how to enforce that.
>
> Thanks!
>
>
> On Sat, Dec 22, 2018 at 5:07 AM sisyphus <sisyphus...@gmail.com> wrote:
>
>> "use 5.008_004" ensures that perl is at version 5.8.4 or later.
>> Try to run that script using perl-5.8.3 or earlier and it will croak with
>> a message that you need to be running version 5.8.4 or later.
>>
>> Cheers,
>> Rob
>>
>> On Sat, Dec 22, 2018 at 8:44 PM Leam Hall <leamh...@gmail.com> wrote:
>>
>>> I've seen code that has "use 5.008_004;" in the files. Yet the code also
>>> uses tools like Build.PL that came after Perl 5.008. What does the "use
>>> $perl_version" actually affect?
>>>
>>> Thanks!
>>>
>>> --
>>> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
>>> For additional commands, e-mail: beginners-h...@perl.org
>>> http://learn.perl.org/
>>>
>>>
>>>

Reply via email to