Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by rsFalse (Hermit)
on Jan 14, 2019 at 21:27 UTC ( #1228547=note: print w/replies, xml ) Need Help??


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

This is perl 5, version 18, subversion 2 (v5.18.2)
  • Comment on Re^2: Case where '( shift @_ )[ 0, 0 ]' returns only one value?

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

    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

      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.

Re^3: Case where '( shift @_ )[ 0, 0 ]' returns only one value?
by markong (Monk) on Jan 14, 2019 at 22:12 UTC

    I got the same thing with perl 5, version 18, subversion 1 (v5.18.1) built for x86_64-linux-thread-multi

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2020-01-21 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?