in reply to Re: Autovivification not working?
in thread Autovivification not working?
The way you have avoided the warning is the correct way to do it, although you can be slightly more compact with:
$self->{hash}{$subject} ||= 0;
In summary, you are trying to fix the wrong problem. Perl isn't being tricky this time. All it's doing is warning you that it is turning an 'undef' into a '0' for the addition. This is what you want.
____________________
Jeremy
I didn't believe in evil until I dated it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Autovivification not working?
by Juerd (Abbot) on Dec 20, 2001 at 19:41 UTC | |
by jepri (Parson) on Dec 20, 2001 at 19:55 UTC | |
by Juerd (Abbot) on Dec 20, 2001 at 20:04 UTC |