In order to tell you why I downvoted you (as per danmcb's request), in the hopes that you don't do this again, I'm responding to this. I also see I'm not the first to downvote this nonsense.
vishi83, please, please, please - test your code before you post it. Someone has already posted a working response, which disagrees with yours on a fundamental level: syntax. TMTOWTDI, perhaps, but if it's a WTDI, it needs to be syntactically correct for the problem at hand.
And the output:#!/usr/bin/perl -w use strict; use warnings; my $IpInfo = [ [ qw(20 74 6 55 56) ] ]; my ( $id, $area, $cpu, $ip, $ip2 ) = @$IpInfo[0]; print "$id, $area, $cpu, $ip, $ip2\n";
$ perl ./x.pl Use of uninitialized value in concatenation (.) or string at ./x.pl line 10. Use of uninitialized value in concatenation (.) or string at ./x.pl line 10. Use of uninitialized value in concatenation (.) or string at ./x.pl line 10. Use of uninitialized value in concatenation (.) or string at ./x.pl line 10. ARRAY(0x813bf00), , , ,In other words, you didn't solve any problem. You just changed the syntax of the OP, and came out with the same output. Which would have been completely trivial to test prior to posting, and thus the reason for the downvotes.
If you think that the saints Curates and above don't test their code before they post, I have news for you - they generally do, and, when they don't, they usually tell everyone "Warning: untested code" or something to that effect. That's how they got to the level they're at: by posting answers that testably work. (And sometimes they get points for testing things that don't work, and posting that - and asking why it doesn't work. But at least no one is led astray by using something that doesn't work, and then getting confused as to why they were told to do something and it not working for them.)
Please, please, please. Test your code before posting. It'll even save you a few XP.
In reply to Re^2: Getting Specific List Elements Out of an Array Reference
by Tanktalus
in thread Getting Specific List Elements Out of an Array Reference
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |