develooper Front page | perl.perl5.porters | Postings from January 2001

Re: Multiple post(inc|dec)rement

Thread Previous | Thread Next
Johan Vromans
January 16, 2001 13:10
Re: Multiple post(inc|dec)rement
Message ID:
Stephen McCamant <smcc@CSUA.Berkeley.EDU> writes:

> JV> But I still think that
> JV> perl -e '@a = (++$i,++$i,++$i); print "@a\n"'
> JV> should print "1 2 3".
> IMHO, pp_pre(inc|dec) were written the way they are now for a reason
> (namely efficiency), and it isn't worth slowing them down just to make 
> some pathological examples more intuitive. If you want "1 2 3", you
> can always write

Darn. I know a zillion ways to get "1 2 3" in an array :-).

My point is that unlogical exceptions like @a = (++$i,++$i,++$i) are
hard to explain, and make people turn away from Perl.

-- Johan

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About