Closed p5pRT closed 20 years ago
Under Perl 5.6\, the variable $] contains the value 5.006 rather than the expected 5.6. $^V contains 5.6.0.
Before you jump in and tell me that $] is deprecated; it's not\, it's just old\, and it's more portable given that $^V isn't defined in pre-5.6 Perl. So\, if I'm going to do the test of "is this Perl less than Perl 5.6) I need to use $] to do it.
Unfortunately\, 5.006 _is_ lt 5.6!
Code to reproduce:
require 5.6.0;
print "Running Perl version $]\n"; print "Running Perl version "; printf ("%vd\n"\, $^V); # uninitialized var in 5.004 and 5.00503
warn "No 'our' declarations!\n" if $^V lt v5.6; warn "Cannot use our in version $]!\n" if $] \< 5.6;
Output
Running Perl version 5.006 Running Perl version 5.6.0 Cannot use our in version 5.006!
On Fri\, Feb 16\, 2001 at 01:05:19PM -0800\, vicki.brown@barclaysglobal.com wrote:
Under Perl 5.6\, the variable $] contains the value 5.006 rather than the expected 5.6. $^V contains 5.6.0.
That is correct. The numeric version of perl5.6 is 5.006.
Before you jump in and tell me that $] is deprecated; it's not\, it's just old\, and it's more portable given that $^V isn't defined in pre-5.6 Perl. So\, if I'm going to do the test of "is this Perl less than Perl 5.6) I need to use $] to do it.
Unfortunately\, 5.006 _is_ lt 5.6!
Code to reproduce:
require 5.6.0;
That will not generate the intended behavior in older versions of Perl. (They will complain that the module 5.60 is not found.) Use require 5.006 instead.
print "Running Perl version $]\n"; print "Running Perl version "; printf ("%vd\n"\, $^V); # uninitialized var in 5.004 and 5.00503
warn "No 'our' declarations!\n" if $^V lt v5.6; warn "Cannot use our in version $]!\n" if $] \< 5.6;
That should be:
warn "Cannot use our in version $]!\n" if $] \< 5.006;
Ronald
Migrated from rt.perl.org#5836 (status was 'resolved')
Searchable as RT5836$