Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Make $^V and "my" implicit

by dsheroh (Prior)
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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2016-10-28 09:35 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (379 votes). Check out past polls.