I'm not exactly sure either. I attempted to write some Test scripts. Getting only as far as comparing a couple of variations.

heres two scripts that start out looking to compare list and scalar context asignment. I'm not sure they have picked up what you are viewing, but could possibly get there?

A B my @x @y Scalar Context

use strict; use warnings; use feature qw'say state'; use diagnostics -verbose; #use Test::More test=>1; A B my @x @y Scalar Context my @x; my @y; if( ( fork() ) == 0 ){ if( ( fork() ) == 0 ){ say 'A: scalar context'; @x ? do{say 'A @x not empty'} : do{say 'A @x empty'}; my $s = shift @x; @x ? do{say 'A $s = shift @x; @x not empty'} : do{say 'A $s = shif +t @x; @x empty'}; defined $s ? do{say 'A defined $s'} : do{say 'A undefined $s'}; print "\n"; say 'A: scalar context'; @y ? do{say 'A @y not empty'} : do{say 'A @y empty'}; my $u = splice( @y,0,1 ); @y ? do{say 'A $u = splice @y; @y not empty'} : do{say 'A $u = spl +ice @y; @y empty'}; defined $u ? do{say 'A $u = splice @y; defined $u'} : do{say 'A $u + = splice @y; undefined $u'}; print "\n"; }else{ say 'B: scalar context'; undef @x; @x ? do{say 'B undef @x; @x not empty'} : do{say 'B undef @x; @x e +mpty'}; my $t = shift @x; @x ? do{say 'B $t = shift undef @x; @x not empty'} : do{say 'B $t += shift undef @x; @x empty'}; defined $t ? do{say 'B $t = shift undef @x; defined $t'} : do{say +'B $t = shift undef @x; undefined $t'}; print "\n"; say 'B: scalar context'; undef @y; @y ? do{say 'B undef @y; @y not empty'} : do{say 'B undef @y; @y e +mpty'}; my $v = splice( @y,0,1 ); @y ? do{say 'B $v = splice undef @y; @y not empty'} : do{say 'B $v + = splice undef @y; @y empty'}; defined $v ? do{say 'B $v = splice undef @y; defined $v'} : do{say + 'B $v = splice undef @y; undefined $v'}; print "\n"; exit; } say "A B Done\n"; exit; }else{ say "\n",'A B my @x @y Scalar Context',"\n"; }

C D my (@x),(@y) List Context

use strict; use warnings; use feature qw'say state'; use Data::Dump; use diagnostics -verbose; # C D my (@x),(@y) List Context my (@x); my (@y); if( ( fork() ) == 0 ){ if( ( fork() ) == 0 ){ say 'C: list context'; @x ? do{say 'C @x not empty'} : do{say 'C @x empty'}; my ($s) = shift @x; @x ? do{say 'C ($s) = shift @x; @x not empty'} : do{say 'C ($s) = +shift @x; @x empty'}; defined $s ? do{say 'C defined $s'} : do{say 'C undefined $s'}; print "\n"; say 'C: list context'; @y ? do{say 'C @y not empty'} : do{say 'C @y empty'}; my ($u) = splice( @y,0,1 ); @y ? do{say 'C ($u) = splice @y; @y not empty'} : do{say 'C ($u) = + splice @y; @y empty'}; defined $u ? do{say 'C ($u) = splice @y; defined $u'} : do{say 'C +($u) = splice @y; undefined $u'}; print "\n"; }else{ say 'D: list context'; undef @x; @x ? do{say 'D undef @x; @x not empty'} : do{say 'D undef @x; @x e +mpty'}; my ($t) = shift @x; @x ? do{say 'D ($t) = shift undef @x; @x not empty'} : do{say 'D ( +$t) = shift undef @x; @x empty'}; defined $t ? do{say 'D ($t) = shift undef @x; defined $t'} : do{sa +y 'D ($t) = shift undef @x; undefined $t'}; print "\n"; say 'D: list context'; undef @y; @y ? do{say 'D undef @y; @y not empty'} : do{say 'D undef @y; @y e +mpty'}; my ($v) = splice( @y,0,1 ); @y ? do{say 'D ($v) = splice undef @y; @y not empty'} : do{say 'D +($v) = splice undef @y; @y empty'}; defined $v ? do{say 'D ($v) = splice undef @y; defined $v'} : do{s +ay 'D ($v) = splice undef @y; undefined $v'}; print "\n"; exit; } say "C D Done\n"; exit; }else{ say "\n",'C D my (@x),(@y) List Context',"\n"; }

In reply to Re^3: shift on empty array in list context broken by Don Coyote
in thread shift on empty array in list context broken by LanX

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.