in reply to Re^3: Use of freed value
in thread Use of freed value

Well I tend to avoid such side effects because of this experience.

hum? We use the side effects of putting the actual scalars on the stack all the time (e.g. $x = 3;). I presume you mean you avoid using writing to the scalar twice in the same statement, and avoid writing to the same scalar twice in the same statement.

The thing is, @a, @a=() doesn't do that, at least not any more than splice(@a) or shift(@a) do, and I'm pretty sure you don't avoid those.

Replies are listed 'Best First'.
Re^5: Use of freed value
by LanX (Saint) on Jun 27, 2019 at 22:43 UTC
    > I'm pretty sure you don't avoid those.

    I rarely chain statements having side effects with the coma operator.

    Only exception are one liners.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      In that case, to put it in your words, the purposes of my posts was to explain (to those interested) why one suffers after crossing the red line in this situation.

      That said, the reason one suffers in this situation is completely different than the reason one suffers with call(++$x, ++$x).

        I don't doubt that the mechanisms are different.

        I think it's just badly tested design because it's "uncharted area" nearly nobody enters.

        Which could also be considered a "reason".

        It's worth noting that some languages are side effect free by design.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice