Anyone know what $::{varname} does ?

Jonathan Stowe jns at
Thu Oct 18 02:53:50 PDT 2007

On Thu, 2007-10-18 at 10:24 +0100, Edwardson, Tony wrote:
> I have just changed job and have inheritted a load of perl scripts and
> modules which refer to variables with
> $::varname all over the place
> I guess that this is equivalent to $MAIN::varname but as none of these
> scripts contain a package statement I'm not sure why this was done.
> Can anyone enlighten me ?

It is the same as $main::varname yes. I'd guess that it was done to
naïvely get rid of the errors you'd get with "use strict" without having
to potentially refactor the code to use lexically scoped variables.


More information about the MiltonKeynes-pm mailing list