Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Getting Specific List Elements Out of an Array Reference

by pg (Canon)
on Oct 31, 2005 at 05:54 UTC ( [id://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].

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-18 00:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found