develooper Front page | perl.perl5.porters | Postings from December 2014

Re: *-couragement of $^V

Thread Previous | Thread Next
From:
David Golden
Date:
December 11, 2014 17:30
Subject:
Re: *-couragement of $^V
Message ID:
CAOeq1c9aAOmr=UxyyFJvMWas_HO6im9qCud2qYRqp8Hh_bByWQ@mail.gmail.com
On Thu, Dec 11, 2014 at 12:11 PM, Ricardo Signes <perl.p5p@rjbs.manxome.org>
wrote:

> Can you tell me when/how it's more DWIMmy?  I


Post 5.10:

(1) stringifies nicer than $]
(2) overloaded comparision

For #2, it makes "eq" and "==" equivalent, and ensures proper tuple
comparison.  I recall that inadvertent floating point comparison for
equality caused problems due to 64 bit float precision.  (That may have
been fixed in some perl version.)

It's lets people express version comparison with either v-strings or
strings or decimals:

    $^V == v5.10.1 or $^V == "v5.10.1" or $^V == 5.010001

That's handy if the right operand came from some variable somewhere (e.g.
from a text file) -- you don't need to care what format it's in.  You don't
have to inspect, or convert, or pick the right type of comparison operator.

David

-- 
David Golden <xdg@xdg.me> Twitter/IRC: @xdg

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About