Why is it possible to use an object as a counter?
You are not using the object as a counter but the de-reference of the object. $self is the object but it's also a reference to a scalar (since that's how you have constructed it). When you de-reference the object therefore you get a scalar and so $$self++ is incrementing the scalar. Since the example you mentioned starts with $active = 0, that's the value from which you will be incrementing.
In reply to Re: Why does $$self++ work?
by hippo
in thread Why does $$self++ works?
by rob25
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |