>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:
SB> $user_ref->{$username}{payment} += $payment ||= $payment; SB> $user_ref->{$username}{amount} += $amount ||= $amount; assuming no entries in payment or amount, you don't need the ||= at all. += will work on an undef (or non-existing hash) value and coerce it to 0 and then add the number. it will not trigger warnings as this is a useful case of ignoring undef values. .= (append string) also doesn't trigger warnings for the same reason. perl -lwe 'my %x; print( $x{y} += 3 )' 3 perl -lwe 'my $x ; print( $x .= "cd" )' cd perl does all sorts of little things like that. read more about autovivication in my article: http://sysarch.com/Perl/autoviv.txt uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Free Perl Training --- http://perlhunter.com/college.html --------- --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/