Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Case where '( shift @_ )[ 0, 0 ]' returns only one value?

by stevieb (Canon)
on Jan 14, 2019 at 21:35 UTC ( [id://1228548]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Case where '( shift @_ )[ 0, 0 ]' returns only one value?
in thread Case where '( shift @_ )[ 0, 0 ]' returns only one value?

Ok. I'll do some installs of other versions on Linux and Windows and try to get to the version where it's borked while I finish my work day. On my Windows system I sometimes develop on, with 5.28.1, I get the aa as well:

c:\repos\berrybrew>perl -le "@_ = qw( a b c ); print( ( shift @_ )[ 0, + 0 ] );" aa c:\repos\berrybrew>perl -le "@_ = qw( a b c ); @A = ( shift @_ )[ 0, 0 + ]; print @A" aa c:\repos\berrybrew>perl -v This is perl 5, version 28, subversion 1 (v5.28.1) built for MSWin32-x +64-multi-thread

Replies are listed 'Best First'.
Re^4: Case where '( shift @_ )[ 0, 0 ]' returns only one value?
by AnomalousMonk (Archbishop) on Jan 14, 2019 at 21:41 UTC

    This behavior appears somewhere between versions 5.12.3 and 5.14.4, but a quick scan of the deltas (update: between these versions) shows no justification for it. (Update: All code run under Windows 7.)

    c:\@Work\Perl\monks>perl -wMstrict -le "print 'perl version: ', $]; ;; use Data::Dumper; ;; @_ = qw( a b c ); print( ( shift @_ )[ 0, 0, 0 ] ); ;; @_ = qw( a b c ); my @A = ( shift @_ )[ 0, 0, 0 ]; print Dumper \@A; ;; @A = ( 'x', 'y', 'z' )[ 0, 0, 0 ]; print Dumper \@A; " perl version: 5.012003 aaa $VAR1 = [ 'a', 'a', 'a' ]; $VAR1 = [ 'x', 'x', 'x' ]; perl version: 5.014004 aaa $VAR1 = [ 'a', undef, undef ]; $VAR1 = [ 'x', 'x', 'x' ];
    Version 5.14 is the latest I can access ATM.


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

      Nice catch AnomalousMonk, but it still breaks for me on 5.18 per OP's statement above:

      c:\repos\berrybrew>perl -le "@_ = qw( a b c ); @A = ( shift @_ )[ 0, 0 + ]; print @A" a c:\repos\berrybrew>perl -v This is perl 5, version 18, subversion 4 (v5.18.4) built for MSWin32-x +64-multi-thread

      I'm having some issues (per CB mention) with fetching versions on my Unix machines with perlbrew available, so all I can test on is Windows currently.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1228548]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-19 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found