in reply to Instance Module

The whole thing about my variables is a bit difficult to get your head around. Advanced Perl Programming does a wonderful job of explaining it. This is some of the wisdom I think I have gained on the subject...not 100% sure of course....

Basically, a my variable is a lexical varaible. It has nothing to do with packages, so forget about that. Think in terms of lexical scope. A file is a lexical scope. A block is a lexical scope( whatever is inside a pair of { } ). A package is _not_ a lexical scope. It just seems that way, because everyone usually puts one and only one package in a file, basically creating a lexical scope for that package.

So, for your specific example, put my $image inside sub one, and you are game. If you want it to persist each time you call one, do it like this:

Package Pack; { my $image; sub one { ($image)=@_; } } sub two { print $image; }
Notice the extra set of braces. We have just created a scope for $image, so that one can see it, but two can't. Hope this clears things up a bit, goldclaw