There are many ways to do this. Here is just one example using a closure.
package Remember; # this is a closure { my $savedData = 0; # only accessible within this scope; side effect is that # it stays around as long as the module since the following # method needs it sub rememberData { my $class = shift; $savedData = shift if @_; # update with new value if given return $savedData; # return current value } } 1; Here is a test program to validate that the data in $savedData stays around. use Remember; my $val = Remember->rememberData; print STDOUT "Remembered value is: $val\n"; $val = Remember->rememberData(5); $val = Remember->rememberData; print STDOUT "Remembered value is: $val\n"; Running the program above yields Remembered value is: 0 Remembered value is: 5 -----Original Message----- From: Rex Arul [mailto:[EMAIL PROTECTED]] Sent: Monday, October 29, 2001 9:20 PM To: [EMAIL PROTECTED] Subject: Persisting Values Across Method Calls Friends, How can I persist values across method calls, without using Global Variables? IS there kind of "static" variables and if so can any of you provide a simple code example to prove the point? Thanks in advance, Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]