Hi Chris,

On Mon, 14 Nov 2011 00:31:19 -0600
Chris Stinemetz <chrisstinem...@gmail.com> wrote:

[SNIP]

> # header
> print "HOUR\tCELL\tHEH_TYPE\tHEH_COUNT\n";
> # body
> foreach my $hour (sort {$a <=> $b} keys %CELL){
>   foreach my $cellNo (sort {$a <=> $b} keys %{$CELL{$hour}}) {
>     print "$hour\t $cellNo\t";
>     foreach my $hehCount (keys %CELL_TYPE_COUNT) {
>       if (exists $CELL{$hour}{$cellNo}{$hehCount}) {
>       print "\t $CELL{$hour}{$cellNo}{$hehCount}";
>       }
>     }
>     print "\n";

The problem here is that «print "$hour\t $cellNo\t";» will be printed only once
for the entire $hehCount loop. You need to print it at every iteration.

Otherwise you keep saying «$CELL{$hour}» and other repetitive lookups. Please
use a variable to hold that:

        foreach my $hour (sort {$a <=> $b} keys %CELL){
                my $hour_cell = $CELL{$hour};
                # Use both $hour and $hour_cell

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Linux — Because Software Problems Should not Cost Money.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to