develooper Front page | perl.perl5.porters | Postings from August 2018

Re: [perl #133301] Evalulation order during concat changed

Thread Previous | Thread Next
Dave Mitchell
August 10, 2018 17:56
Re: [perl #133301] Evalulation order during concat changed
Message ID:
On Fri, Aug 10, 2018 at 06:24:56PM +0200, Wolf-Dietrich Moeller (Munchen) wrote:
> $e = 'ab'; $f = 'cd'; $x = $e.$f.($f = 'FF');print '$x = '.$x;
> $x = abcdFF     #### up to Perl 5.26
> $x = abFFFF     #### in Perl 5.28.0

> As 'concat' operation is left-associative (see perlop-documentation),
> first $e.$f is evaluated. As second step the following bracket
> is evaluated, assigning 'FF' to $f. As third step the second
> concat is evaluated.

The issue here is what order (if any) does perl guarantee sub-expressions
to be evaluated? For example in

    ($a+$b) * ($c*$d)

does perl guarantee that the first addition will take place before the
second addition? I think the answer is no, although I'm willing to be
proved wrong. If not, then multiconcat has only changed undefined

Diplomacy is telling someone to go to hell in such a way that they'll
look forward to the trip

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