Thank you Shlomi. For some reason my final value for the keys is being repeated 24 times so I am guessing I have an issue with how I am iterating over the hashes.
I can't seem to find the correct way to fix it so the value displays once. Any help is greatly appreciated. An example of the output is: HOUR CELL HEH_TYPE HEH_COUNT 00 13 CDM 1, 2, CBR 2, 5MHz,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10 00 68 CDM 1, 2, CBR 1, 15MHz,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 00 816 CDM 1, 2, CBR 2, 15MHz,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 00 818 CTRM,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 00 830 CTRM,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 00 875 CDM 1, CCU 1, CE 1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 00 875 CDM 1, CCU 1, CE 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 00 875 CDM 1, CCU 1, CE 5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 00 875 CDM 2, CCU 1, CE 3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 00 962 CDM 2, CRC,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 00 983 CDM 1, CCU 1, NO ACCESS,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 00 983 CDM 1, CCU 2, NO ACCESS,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 00 983 CTRM,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 01 111 CDM 1, 2, CBR 2, 5MHz,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16 #!/usr/bin/perl use warnings; use strict; use POSIX; use Data::Dumper; use diagnostics; my $filepath = sprintf("/omp/omp-data/logs/OMPROP1/%s.APX",strftime("%y%m%d",localtime)); my $runTime = sprintf("/home/cstine/heh/hehOut/%s.txt",strftime("%Y-%m-%d",localtime)); my $fileDate = strftime("%y%m%d%H%",localtime); open my $FIN, '<', $filepath or die "ERROR opening $filepath: $!"; open my $out, '>', $runTime or die "ERROR opening $runTime: $!"; my %CELL; my $timestamp; my $hour; while (my $line = <$FIN>) { if ($line =~ m|\d{1,2}/\d{1,2}/\d{2} ((\d{1,2}):\d{1,2}:\d{1,2})|) { $timestamp = $1; $hour = $2; } if ($line =~ /CELL\s*(\d+)\s*(.*),\s*HEH/) { if ((0 <= $hour)&&($hour <=23)) { $CELL{$hour}{$1}{$2}++; } } } # header print "HOUR\tCELL\tHEH_TYPE\t\tHEH_COUNT\n"; # body foreach my $hour (sort keys %CELL) { foreach my $cellNo (sort keys %{$CELL{$hour}}) { foreach my $hehType (sort keys %{$CELL{$hour}{$cellNo}}) { print "$hour\t$cellNo\t$hehType"; foreach my $hehCount (sort keys %CELL) { print ",$CELL{$hour}{$cellNo}{$hehType}"; } print "\n"; } } } thank you , Chris