Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Dereference anonymous AoA

by Anonymous Monk
on Aug 08, 2014 at 19:41 UTC ( [id://1096807]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    foreach my $i( ['kept', 82], ['notkept', 1], ['repaired', 3] ) { ...
    # so $aref->[$i][0]
    # looks like $areg->[ ['kept', 82] ][0]
    #
    
  2. or download this
    $ perl buggy_array.pl 2> out.txt
    
    ...
    Use of uninitialized value in concatenation (.) or string at ary.pl li
    +ne 21.
    Use of reference "ARRAY(0x1d0fbf8)" as array index at ary.pl line 21.
    Use of uninitialized value in concatenation (.) or string at ary.pl li
    +ne 21.
    
  3. or download this
    perl -E 'my $aref=[undef]; say 0 + $aref'
    19468616
    
  4. or download this
    $areg->[ ['kept', 82] ][0]
    
    # becomes something like
    # $areg->[ 9999999 ][0]
    # (or whatever the memory address of that array is...)
    
  5. or download this
    perl -E 'my $aref=[undef]; $aref->[1000][0]; say scalar @{ $aref }'
    1001
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found