in reply to letters++, bug or trick?
It's all perfectly logical really. The first thing to notice is that the initialisation of $c makes no difference to the outcome:
perl -e "$c=qq(z);$d=qq(d); $c = $d++; $d = $c++; print $c,$d;" ed perl -e "$d=qq(d); $c = $d++; $d = $c++; print $c,$d;" ed
So,
In the end, the whole thing reduces to:
perl -e "$d=qq(d); $c = $d; $d = $c++; print $c,$d;" ed
or even just
perl -e "$c = $d = qq(d); $c++; print $c,$d;" ed
Which looks a lot less mysterious :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: letters++, bug or trick?
by xiaoyafeng (Deacon) on Jan 30, 2010 at 07:51 UTC |