A possibly helpful test:

c:\@Work\Perl\monks>perl -le "use warnings; use strict; ;; use Test::More 'no_plan'; use Test::NoWarnings; ;; note 'perl version: ', $]; ;; @_ = qw(a b c); note 'raw print list context shift: ', (shift @_)[ 0, 0, 0 ]; ;; @_ = qw(a b c); ok 'aaa' eq join('', (shift @_)[ 0, 0, 0 ]), 'joined shift'; ;; @_ = qw(a b c); my @ra = (shift @_)[ 0, 0, 0 ]; is_deeply \@ra, [ 'a', 'a', 'a' ], 'assigned shift'; ;; @ra = ('x', 'y', 'z')[ 0, 0, 0 ]; is_deeply \@ra, [ 'x', 'x', 'x' ], 'assigned list'; ;; done_testing; " # perl version: 5.014004 # raw print list context shift: aaa ok 1 - joined shift not ok 2 - assigned shift # Failed test 'assigned shift' # at -e line 1. # Structures begin differing at: # $got->[1] = undef # $expected->[1] = 'a' ok 3 - assigned list 1..3 ok 4 - no warnings 1..4 # Looks like you failed 1 test of 4.

Update: The problem seems to have been localized between about versions 5.14.x and 5.18.x inclusive so the following may be irrelevant, but just for the heck of it, the code above passes all tests for ActiveState 5.008009 and Strawberries 5.010001 and 5.012003, all running under Windows 7.


Give a man a fish:  <%-{-{-{-<


In reply to Re: Case where '( shift @_ )[ 0, 0 ]' returns only one value? by AnomalousMonk
in thread Case where '( shift @_ )[ 0, 0 ]' returns only one value? by rsFalse

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.