[Edinburgh-pm] code style question

Miles Gould miles at assyrian.org.uk
Tue Aug 16 04:49:09 PDT 2011


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


More information about the Edinburgh-pm mailing list