in reply to Re: static storage in a local subroutine?
in thread static storage in a local subroutine?

You need to make that "BEGIN {" not "{" to ensure that the initialization for $count happens once and only once. For example, if that code were in some sort of outer loop, you'd get $count cannot stay shared (I think), and if you had an initializer for $count, but that block were at the end of the file, "manipulate_count" would be called before $count had been initialized.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re^2: static storage in a local subroutine?