Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 romping around the Monastery: (5)
As of 2015-07-06 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls