Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use test_module; my %hash; $hash{foo} = "bar"; $hash{bar} = "foo"; &test
The goal of this exercise is to print the contents of $hash{foo} without passing a reference to %hash as an argument to the sub "test".use strict; sub test { my $test = $main::hash{foo}; print "$test\n"; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: variables across modules
by chromatic (Archbishop) on Aug 02, 2003 at 20:14 UTC | |
by liz (Monsignor) on Aug 02, 2003 at 20:25 UTC | |
|
Re: variables across modules
by tcf22 (Priest) on Aug 02, 2003 at 20:14 UTC | |
|
Re: variables across modules
by bobn (Chaplain) on Aug 02, 2003 at 23:09 UTC |