Nice technique. It seems to me that it's a handy step on the way to splitting things off into modules and/or object-oriented bits. Since all the references go through your global hash anyway, when you split off a function/module/object, the code in your subroutines wouldn't have to change much:
BEFORE
AFTERmy %my_global_values = (foo=>0, etc=>0); my $rGlobals = \%my_global_values; sub zigafoo { $rGlobals-> = 7 }
...roboticuspackage barbaz; my %my_package_values = (foo=>0); my $rPackage = \%my_package_values; sub foobar { $rPackage->{foo} = 7; }
In reply to Re^3: Global Vars
by roboticus
in thread Global Vars
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |