in reply to Static Variables in Perl
...or, you could do something like the following:
which printed:package A; use vars qw/$knob1/; package B; @ISA=('A'); *knob1 = *A::knob1; package main; $A::knob1 = 'a knob1'; $B::knob1 = 'b knob1'; print $A::knob1, "\n"; print \$A::knob1, "\n"; print \$B::knob1, "\n";
showing that the two variables are each a name for the same location.b knob1 SCALAR(0x10062530) SCALAR(0x10065230)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Static Variables in Perl
by benizi (Hermit) on Apr 01, 2006 at 07:00 UTC |