You will find the following code equivalent to $array[++$x] = ++$x;:
do { local @_;
alias $_[0] = ++$x; # Aliases to $x
alias $_[1] = $array[++$x];
$_[1] = $_[0]
};
As you can see, the LHS is fully evaluated before the RHS, yes you still get the effect you say can't happen under those conditions.
If you don't have Data::Alias (like me), you can use the following code:
do { our $arg0; local *arg0 = \( ++$x );
our $arg1; local *arg1 = \( $array[++$x] );
$arg1 = $arg0;
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.