http://www.perlmonks.org?node_id=1062202


in reply to Re^2: shift in list context buggy?
in thread shift in list context buggy?

They are documented to be equal...

... when used in a void context!


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: shift in list context buggy?
by LanX (Saint) on Nov 12, 2013 at 14:47 UTC
    > ... when used in a void context!

    And where is this supposed to be documented?

    splice doesn't even mention "void".

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      splice doesn't even mention "void".

      No, but the equivalence documentation you cite shows all examples in void contexts.

      And in that context, the examples -- designed to explain the somewhat complex behaviour of splice in terms of the readily understandable push, pop, shift & unshift -- are exactly equivalent. Ie. Their affect on the running programs are identical.

      But those examples are meant to explain splice in terms of the simpler operations -- not the other way around.

      You are the only person who is trying to misinterpret these simple examples of equivalence within the very restricted context in which they are show -- all void; ie. devoid of any assignments or if or while statements -- in an obscure part of the documentation, to be some definitive statement that was never intended, in support of conclusions that do not stand up and have zero merit.

      Worse thing is; you know it; but you keep on bleating away at it....


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        > No, but the equivalence documentation you cite shows all examples in void contexts.

        Obviously wrong!

        Again! Please quote otherwise and provide a link!

        Cheers Rolf

        ( addicted to the Perl Programming Language)

      Funny LanX
      shift(@a) splice(@a,0,1)
      shift is equivalent to splice ONE
        > shift is equivalent to splice ONE

        Nope, not in list context, read the OP again....

        Cheers Rolf

        ( addicted to the Perl Programming Language)