note
jgallagher
I believe BrowserUK's point is that if <code>foo</code> is just a global subroutine, there is no difference. On the other hand, suppose you had
<code>
package Bar;
sub new { ... }
sub foo {
state $bar;
$bar++;
return $bar;
}
</code>
Then later...
<code>
$bar1 = Bar->new();
$bar2 = Bar->new();
$bar1->foo(); # returns 1, as you would expect
$bar1->foo(); # returns 2, as you would expect
$bar2->foo(); # returns 3, possibly unexpected
</code>
At least this is my understanding. Is this what you meant, BrowserUK?
473561
473574