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

Re: *-couragement of $^V

Thread Previous | Thread Next
From:
Leon Timmermans
Date:
December 9, 2014 02:23
Subject:
Re: *-couragement of $^V
Message ID:
CAHhgV8heoL46VCXP9WB9MwthiMj7p5eoJ-PuE5G9fF0as1Yeiw@mail.gmail.com
On Mon, Dec 8, 2014 at 9:30 PM, Ricardo Signes <perl.p5p@rjbs.manxome.org>
wrote:

> A few times lately, $^V has come up in the context of being "the better
> way to
> check the version than $]."  This surprised me, because I always thought
> it was
> largely considered better avoided.
>
> I suggest that given the general confusion around v-strings and version
> objects, as well as the fact that $^V has changed its behavior in the
> past, it
> is not actually better than $].  Since $] always works, and always works
> the
> same way, we should encourage its use rather than $^V's.  We can accomplish
> that by discouraging the use of $^V, in favor of $], in the docs.
>

The one things $^V is good for is producing a pretty user readable perl
version, like «perl -e 'printf "%vd\n", $^V'». It might have been a lot
more useful if it was just that sort of string. The representation change
means that simple usages are often wrong and most complicated usages are
typically also possible with $].

Leon

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