Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This code prints "param". I guess I'm confused as to how instances of packages are created. I assumed that the two calls to subs one and two in the main code above were separate and that the variable image would not retain its value between the two calls.Package Pack; my $image; sub one { ($image)=@_; } sub two { print $image; } ##main code use Pack; Pack::one("param"); my $ret=Pack::two(); print $ret;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Instance Module
by goldclaw (Scribe) on Jan 17, 2001 at 22:35 UTC | |
|
Re: Instance Module
by chipmunk (Parson) on Jan 17, 2001 at 22:44 UTC | |
|
Re: Instance Module
by arturo (Vicar) on Jan 17, 2001 at 22:16 UTC |