Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Getting Specific List Elements Out of an Array Reference

by pg (Canon)
on Oct 31, 2005 at 05:54 UTC ( #504160=note: print w/ replies, xml ) Need Help??


in reply to Getting Specific List Elements Out of an Array Reference

my ( $id, $area, $cpu, $ip, $ip2 ) = @{$IpInfo->[0]};

With what you did, you simply assigned $IpInfo->[0], an array ref to $id. You can prove this by:

use Data::Dumper; use strict; use warnings; my $IpInfo = [ [ '20', '74', '6', '55', '56' ] ]; my ( $id, $area, $cpu, $ip, $ip2 ) = $IpInfo->[0]; print Dumper($id);

Which prints:

$VAR1 = [ '20', '74', '6', '55', '56' ];

And that's what you got earlier when you tried to dump $IpInfo->[0].


Comment on Re: Getting Specific List Elements Out of an Array Reference
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (20)
As of 2014-07-31 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (250 votes), past polls