[Edinburgh-pm] code style question

Alex Brelsfoard alex.brelsfoard at gmail.com
Tue Aug 16 06:39:43 PDT 2011

Thanks Miles,

Yeah, I sometimes feel like "You're either with it or against it" when it
comes to "use strict;".  And since $:: is kind of a backdoor to get around
strict.... Let's just say I'm not a fan ;)

I looked it up and $:: is apparently a shortcut for $main:: .
Interesting, but still doesn't tell me why someone would choose to use that


On Tue, Aug 16, 2011 at 12:49 PM, Miles Gould <miles at assyrian.org.uk> wrote:

> On Tue, Aug 16, 2011 at 11:46 AM, Alex Brelsfoard
> <alex.brelsfoard at gmail.com> wrote:
> > if ($::var) {
> >    ...
> > }
> I have never seen this before. Isn't it just referencing a variable in
> the package whose name is empty?
> > To my understanding this is a bit messy, and not to mention potentially
> > dangerous as it kinda goes against the "use strict;" methodology, does it
> > not?
> perl -E 'use strict; $::fred = 7; say $::fred'
> works fine for me! So I guess the point of this scheme is that it
> allows you to use global variables (worse, *undeclared* global
> variables) under the strict pragma. If that's the case, then my advice
> is to dust off and nuke the site from orbit: it's the only way to be
> sure. If your budget won't stretch to orbital nukes, then burning it
> with fire may be an acceptable workaround.
> HTH,
> Miles
> Miles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/edinburgh-pm/attachments/20110816/97fb17c3/attachment.html>

More information about the Edinburgh-pm mailing list