let me charge in with my new found understanding, limited as it may be.

reverse is unlikely to solve the original problem: printit($var,$var++);
will produce exactly the same as printit(reverse($var++,$var)), namely '21'.

Also, the named args would suffer from exactly the same issue - have you tried foo(x => $var, y => $var++) with your construction? After all, it is just another way of writing foo("x",$var,"y",$var++)

From what I gather, Perl always sends things effectively by reference - and that reference is decided in a left-to-right order over the arguments. The thing is, when it sees $var++, it copies the value of $var to a temporary variable, increases $var, but sends a reference to the temp.
From there onwards, no changes in $var would have influence on what is sent from the spot of $var++ - nothing else is referencing that temp var. Where $var is, on the other hand, we have already decided to send the reference to $var - but the other terms may also have access to that piece of memory, in which case only what is there at the end of the entire argument list matters.
You could try and fix the value in each slot, by sending $var+0, or whatever, but that looks evil

Additionally, if we think about '+' in a functional sort of way, ie $x + $y being actually +($x,$y)... or (+ $x $y), whatever your poison is, then we can solve any sort of conundrums, like what the code below would produce

my $m = 20; print ++$m + $m++;
(ie, 43), or why, for example, the following are completely different:
$var++ + ($var + $var)
and
$var++ + $var + $var
perlop seems to be misleading in that sense:
Auto-increment and Auto-decrement:
``++'' and ``--'' work as in C. That is, if placed before a variable, they increment or decrement the variable by one before returning the value, and if placed after, increment or decrement after returning the value.

In reply to Re^2: order of arguments evaluated by ivancho
in thread order of arguments evaluated by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.