dru145 has asked for the wisdom of the Perl Monks concerning the following question:
splice(@ips, 15); for $i ( 0 .. $#ips ) { print "\t $i is @{$ips[$i]},\n"; } Output: number 0 is 192.168.36.118 12431 46.08%, number 1 is 192.168.80.103 4203 1.56%, number 2 is 192.119.15.61 3627 1.34%, number 3 is 192.19.125.2 1738 0.64%, number 4 is 192.217.1.21 1134 0.42%, number 5 is 192.17.214.10 852 0.32%, number 6 is 192.2.252.1.768 0.28%, number 7 is 192.134.77.97 498 0.18%, number 8 is 192.8.29.90 489 0.18%, number 9 is 192.11.7.17 409 0.15%, number 10 is 192.10.191.29 394 0.15%, number 11 is 192.247.91.18 25 0.09%, number 12 is 192.229.14.7 231 0.09%, number 13 is 192.131.192.206 227 0.08%, number 14 is 192.161.31.247 172 0.06%,
then I tried to add the second column with this code:my @newips = (); my ($x, $y); $y = 0; for ($x = 0; $x < 15; $x++) { push @newips, $ips[$x][$y] }
Which only prints: 192.168.36.118 12431 46.08%my @num = (); $x = 0; for ($y = 0; $y < 15; $y++) { push @num, $ips[$x][$y] }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Array of Arrays Question
by Masem (Monsignor) on Dec 21, 2001 at 02:45 UTC | |
Re: Array of Arrays Question
by indapa (Monk) on Dec 21, 2001 at 03:32 UTC | |
Re: Array of Arrays Question
by Zaxo (Archbishop) on Dec 21, 2001 at 02:57 UTC |