in reply to Undef doesnt work?This has got me stumped

but it is clear here that $blah in the "object" retains this as does $testob??
You are in fact modifying the package variable $blah, and like all package variables, are visible throughout the execution of the program. Whereas a new instance of $testob is being created every time as indicated by the value of $self->{blah} always being at 1 post-increment. See. perlobj for more info on objects in perl.
HTH

_________
broquaint

  • Comment on Re: Undef doesnt work?This has got me stumped

Replies are listed 'Best First'.
Re: Re: Undef doesnt work?This has got me stumped
by pike_uk (Initiate) on Feb 09, 2004 at 10:29 UTC
    Thanks for the reply. I understand the package variable bit, thanks, but when (or how) does this get destroyed? Does the package reference survive until the script dies?
      Correct, package variables live until perl exits, or the variable is explicitly destroyed. If you want shorter lived variables then you'll want to be using lexical variables who's life-span is tied to the length of the surrounding lexical scope (unless they're referenced from a higher scope). For more information on lexical variables see. Lexical scoping like a fox.
      HTH

      _________
      broquaint