in reply to Re: Re: Meta-Obfuscation, explanation of
in thread Meta-Obfuscation, explanation of

This is a fun little gotcha with version strings. The best way to require perl5.6.0 is with require 5.006;. Observe:
% perl5005 -e 'require 5.6' Perl 5.6 required--this is only version 5.00503, stopped at -e line 1. % perl56 -e 'require 5.6' Perl v5.600.0 required--this is only v5.6.0, stopped (did you mean v5. +6.0?) at -e line 1. % perl56 -e 'require 5.6.0' % perl5005 -e 'require 5.6.0' Can't locate 5.60 in @INC (@INC contains: /usr/lib/perl5/5.00503/i386- +linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linu +x /usr/lib/perl5/site_perl/5.005 .) at -e line 1. % perl5005 -e 'require 5.006' Perl 5.006 required--this is only version 5.00503, stopped at -e line +1. % perl56 -e 'require 5.006' %
5.6 doesn't work because perl5.6 interprets it as 5.600 instead of 5.006. 5.6.0 doesn't work because perl5.005 and earlier interpret it as a "5.60" and try to load 5.60.pm. 5.006 is the only form that works in old and new versions of Perl.

Replies are listed 'Best First'.
Re: fun with require version
by clintp (Curate) on Feb 05, 2001 at 23:31 UTC
    I knew this, I've written a few pages on the subject. I just never use it and the head was thinking "oh, some fool's gonna try to run this under 5.005...so let's require 5.6..." and typed it that way. And then wandered off to a movie...