Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Array/List Strangeness (why)

by tye (Sage)
on Aug 05, 2009 at 14:20 UTC ( [id://786122]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        @a = ()[1,0];           # @a has no elements
        @b = (@a)[0,1];         # @b has no elements
        @c = (0,1)[2,3];        # @c has no elements
    
  2. or download this
        @a = (1)[1,0];          # @a has two elements
        @b = (1,undef)[1,0,2];  # @b has three elements
    
  3. or download this
        while ( ($home, $user) = (getpwent)[7,0]) {
            printf "%-8s %s\n", $user, $home;
        }
    
  4. or download this
        while(  ( $home, $user )= @results[7,0]  ) {
            ...
        }
    
  5. or download this
        @c = (0,1)[2,3];        # @c has no elements
    
  6. or download this
        @d= (1,2,3)[9,1,8];  # @d= (undef,2,undef);
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found