|Problems? Is your data what you think it is?|
Make $^V and "my" implicitby gunzip (Monk)
|on Feb 03, 2014 at 17:01 UTC||Need Help??|
gunzip has asked for the
wisdom of the Perl Monks concerning the following question:
If I'm using Perl 5.16 why do I have to type:
... at the top of every script?
Perl is quite capable of determining which version it is running with $^V so why should every modern Perl script have to pay the penalty for spoonfeeding those who are running old code on an upgraded version of Perl like this? It gets worse in Perl 6 with:use v6;
If we're concerned with backwards compatibility with Perl 5 then "use v6;" should be implicit and we specify "use v5;" as required. Better still, just make use of $^V and be done with it, otherwise we're just saddling the language with boilerplate baggage.
Likewise, with "my" variable declarations:my $var = 'whatever';
If we've admonished for so many years to (almost) always use "my" variables for proper scoping surely it is now time to makey "my" implicit? Since 5.16 "use strict" has been implicit so the same should apply to "my" declarations. A "use no my;" pragma could be introduced to manage special cases.