Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Make $^V and "my" implicit

by dsheroh (Parson)
on Feb 04, 2014 at 09:30 UTC ( #1073354=note: print w/ replies, xml ) Need Help??


in reply to Make $^V and "my" implicit

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?
Time to implicitly require my? Sure. That's already been done. If you request the current Perl standards, it turns on strict, too.

Time to make my itself implicit? Nope. It's not time now and it never will be. The fact that you ask the question at all suggests to me that you have greatly misunderstood the purpose (and benefits) of my.

use strict; my $width = 800; if ($height == 768) { $with = 1024; }
This blows up, as it should, because I misspelled $width as $with. If we remove my by somehow "making it implicit", then how is Perl to know that $with is a typo rather than a new variable? That's not a "special case", it's a core benefit of strict.


Comment on Re: Make $^V and "my" implicit
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2014-09-22 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (191 votes), past polls