On Fri, 14 Jun 2002 16:33:57 -0500, Chris Dolan wrote:
>Sorry for the newbie-ish question, but can someone explain why <op>=
>does not warn? Is it because (quoting perlop)
>
> $a += 2; is equivalent to $a = $a + 2; although without
> duplicating any side effects that dereferencing the lvalue
> might trigger
>
>and the warn is considered a side effect? Or is it just a kluge to
>support someone developer's personal preferences?
You may call it a kludge. The reason that I would come up with, is to
make "word count" like scripts without warnings easy. You know:
while(<>) {
while(/(\S+)/g) {
$count{$1}++;
}
}
Oops, that's "++", not "+=". Make it "$count{$1} += 1" if you like, it's
functionally the same thing ;-).
Similar scripts that use ".=" can just as easily be devised. I don't
really think it has much use for the other ops, except maybe for "|=".
--
Bart.