in reply to Re: Ugly ways to declare global variables?
in thread Ugly ways to declare global variables?

More simply, since we don't need to pass names around as strings:
use strict; use warnings; BEGIN { package vars; *::x = \$::x } $x = 5; print $x;

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^3: Ugly ways to declare global variables?
by itub (Priest) on Apr 25, 2005 at 20:15 UTC
    Thanks, good point. What happened was that I based my example too literaly in the vars.pm code, where the variable names are indeed passed around as strings.