mmartin has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; use Tie::IxHash; tie (my %ifSpeeds, "Tie::IxHash"); %ifSpeeds = ( "Gi3/1" => "1000000000", "Gi3/2" => "100000000", "Gi3/3" => "1000000000", "Gi3/4" => "1000000000", "Gi3/5" => "100000000", "Gi3/6" => "1000000000", "Gi3/7" => "1000000000", "Gi3/8" => "1000000000", "Gi3/9" => "100000000", "Gi3/10" => "1000000000", "Gi3/11" => "1000000000", "Gi3/12" => "1000000000", "Gi3/13" => "1000000000", "Gi3/14" => "100000000", "Gi3/15" => "1000000000", "Gi3/16" => "1000000000", "Gi3/17" => "1000000000", "Gi3/18" => "1000000000", "Gi3/19" => "100000000", "Gi3/20" => "1000000000", "Gi3/21" => "100000000", "Gi3/22" => "1000000000", "Gi3/23" => "1000000000", "Gi3/24" => "1000000000", "Gi3/25" => "100000000", "Gi3/26" => "100000000", "Gi3/27" => "100000000", "Gi3/28" => "100000000", "Gi3/29" => "100000000", "Gi3/30" => "100000000", "Gi3/31" => "1000000000", "Gi3/32" => "1000000000" ); my $counter = 1; foreach my $key ( keys %ifSpeeds ) { if ($counter <= 8) { print "$key "; $counter++; } else { print "\n"; $counter = 1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looping Over Hash Skips an Element?
by toolic (Bishop) on Jan 06, 2012 at 17:47 UTC | |
by mmartin (Monk) on Jan 06, 2012 at 18:11 UTC | |
by toolic (Bishop) on Jan 06, 2012 at 18:29 UTC | |
by Eliya (Vicar) on Jan 06, 2012 at 18:42 UTC | |
|
Re: Looping Over Hash Skips an Element?
by Lotus1 (Vicar) on Jan 06, 2012 at 18:28 UTC | |
by pklausner (Scribe) on Jan 10, 2012 at 13:22 UTC | |
|
Re: Looping Over Hash Skips an Element?
by Xiong (Hermit) on Jan 07, 2012 at 20:26 UTC | |
|
Re: Looping Over Hash Skips an Element?
by mmartin (Monk) on Jan 09, 2012 at 15:11 UTC |