rovf has asked for the wisdom of the Perl Monks concerning the following question:

What is the best (portable) way to express that a Perl program requires 5.8.8 or later?

I tried

require v5.8.8;
but got a warning since this doesn't work with old Perl versions. For old versions, the version needs to be syntacically a number. I googled for examples, but did not find any for 5.8.8. I tried the following:

require 5.008_008;
This is syntactically correct, but I wonder whether I really pick the "right" Perl version with this expression.
-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re: Portable way to require Perl 5.8.8
by ikegami (Patriarch) on Mar 18, 2011 at 17:21 UTC

    Works on 5.8+:

    use v5.8.8;

    Works on 5.6+:

    use 5.008_008;

    Works on 5.0+:

    BEGIN { $] >= 5.008_008 or die("Need half-decent Unicode support. " . "Please use Perl 5.8.8 or higher\n"); }

    I could be wrong as to when each started working.

Re: Portable way to require Perl 5.8.8
by chromatic (Archbishop) on Mar 18, 2011 at 17:10 UTC

    The most portable form is:

    use 5.008_008;
Re: Portable way to require Perl 5.8.8
by JavaFan (Canon) on Mar 18, 2011 at 20:54 UTC
    I haven't been able to find a version of Perl that actually warns in require v5.8.8;. All versions I tried either fail (because they don't understand v5.8.8;), or they just accept it.

    I've seen people suggesting to use:

    use 5.006; # First version to accept v-numbers. require v5.8.8;
      I haven't been able to find a version of Perl that actually warns in require v5.8.8;.

      For Instance, 5.10.0 does:

      H:\>perl -lwe "use v5.8.8; print 6" v-string in use/require non-portable at -e line 1. 6

      -- 
      Ronald Fischer <ynnor@mm.st>
        I see. Interestingly, 5.10.1 doesn't warn.