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].

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://504160]
help
Chatterbox?
[choroba]: 1200 years is enough :-)
[marioroy]: Lady_Aleena my $ans = qx! find . -name "*.pl" -exec ls -l {} \\; !;
[Tanktalus]: My basic problem right now is that if I were willing to move, I could be back in Toronto with a pay raise. We have a number of reasons for not wanting to do that.
[marioroy]: I had to backslash the backslash inside qx.
[Tanktalus]: marioroy++ # nice catch
[Lady_Aleena]: marioroy, that makes kinda makes sense.
[Discipulus]: yes i can survive also in younger town.. but when i passed i saw many strange letters..
[Lady_Aleena]: marioroy, sorry, I am not making sense right now.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2017-04-23 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.