in reply to problem unless I use ".="
FWICT you have ample explanations of why the . operator throws a warning, but it looks like nobody* has given a proper explanation of why .= does not throw a warning. And the reason is simple, it is special cased not to. Most (but not all) of the mutator style operators of the form X= (where X could be any operator symbol) are special cased not to throw warnings when used on undef lvalues. Similar rules apply to ++ and --. This is because its generally agreed that its "ok" to do stuff like $hash{somekey}++ or $hash{somekey}.=$str when $hash{somekey} doesn't have a defined value.
* well, liverpole gives an explanation but its not clear to me if the documentation he is referencing explains what he thinks it does. (UPDATE, actually im pretty sure it doesnt. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: problem unless I use ".="
by cgmd (Beadle) on May 13, 2007 at 18:40 UTC |