|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
spacebat's scratchpadby spacebat (Beadle) |
| on Aug 19, 2007 at 09:36 UTC ( #633574=scratchpad: print w/ replies, xml ) | Need Help?? |
Most painful lesson learnt: Allocation and assignment don't always happen together in a 'my' statement. Subroutine scratchpads can persist and hold on to old values. my $var = 'value' if $condition; # this can biteThis is better written as: my $var = $condition ? 'value' : undef; # assignment always happens |
|