use warnings; use strict; use Data::Dumper; my %hash = ( 'Alarms.Alarm Acknowledge' => { 'ScreenName' => 'Alarms', 'Description' => 'Alarm Acknowledge', 'Type' => 'On/Off' }, 'Flow Diagram.Sequence Hold' => { 'ScreenName' => 'Flow Diagram', 'Description' => 'Sequence Hold', 'Type' => 'Momentary' }, 'Flow Diagram.Sequence Advance' => { 'ScreenName' => 'Flow Diagram', 'Description' => 'Sequence Advance', 'Type' => 'Momentary' }, 'Flow Diagram.Sanitize Enable/Disable' => { 'ScreenName' => 'Flow Diagram', 'Description' => 'Sanitize Enable/Disable', 'Type' => 'On/Off' }, 'Trend to USB.Start/Stop Trend Toggle' => { 'ScreenName' => 'Trend to USB', 'Description' => 'Start/Stop Trend Toggle', 'Type' => 'On/Off' }, 'Alarms.Alarm Reset' => { 'ScreenName' => 'Alarms', 'Description' => 'Alarm Reset', 'Type' => 'On/Off' }, 'Alarms.Alarm Trigger' => { 'ScreenName' => 'Alarms', 'Description' => 'Alarm Trigger', 'Type' => 'Momentary' }, ); print Dumper(%hash); print "\n\n\n"; my %ScreenNameCount; $ScreenNameCount{$hash{$_}{ScreenName}}++ foreach keys %hash; my %HashCount; my $Screenkey = 'New'; my $ScreenkeyOld = 'Old'; my @List; my $i = 1; foreach my $key (sort keys %hash) { my $Screenkey = $hash{$key}{'ScreenName'}; my $Description = $hash{$key}{'Description'}; my $Type = $hash{$key}{'Type'}; $HashCount{$Screenkey} = $Screenkey; $HashCount{$Screenkey}= {0 => $ScreenNameCount{$Screenkey}}; if ($Screenkey eq $ScreenkeyOld) { $HashCount{$Screenkey} = {$i => "\\t \\t \\t \\t\& \\mytabhead{$Description} \\t\& $Type \\t\\\\ \\hline \\n $i - $Screenkey - $ScreenkeyOld"}; $i++; } else { $HashCount{$Screenkey} = {$i => "\\mytabhead{$Screenkey} \\t\& \\mytabhead{$Description} \\t\& $Type \\t\\\\ \\hline \\n $i - $Screenkey - $ScreenkeyOld"}; $i=1; } $ScreenkeyOld = $Screenkey; } print "\n\n\n"; print Dumper(%HashCount); print "\n\n\n"; print Dumper \%ScreenNameCount; print "\n\n\n"; #### \multirow{1}{0.85in}{\mytabhead{Trend to USB}} & \mytabhead{Start/Stop Trend Toggle} & On/Off \hline \multirow{3}{0.85in}{\mytabhead{Alarms}} & \mytabhead{Alarm Trigger} & Momentary \cline{2-11} & \mytabhead{Alarm Acknowledge} & On/Off \cline{2-11} & \mytabhead{Alarm Reset} & On/Off \hline \multirow{1}{0.85in}{\mytabhead{Alarms}} & \mytabhead{Sequence Advance} & Momentary \hline\pagebreak \multirow{2}{0.85in}{\mytabhead{Alarms}} & \mytabhead{Sequence Hold} & On/Off \cline{2-11} & \mytabhead{Sanitize Enable/Disable} & On/Off \hline #### $VAR1 = 'Trend to USB'; $VAR2 = { '3' => '\\mytabhead{Trend to USB} \\t& \\mytabhead{Start/Stop Trend Toggle} \\t& On/Off \\t\\\\ \\hline \\n 3 - Trend to USB - Flow Diagram' }; $VAR3 = 'Alarms'; $VAR4 = { '2' => '\\t \\t \\t \\t& \\mytabhead{Alarm Trigger} \\t& Momentary \\t\\\\ \\hline \\n 2 - Alarms - Alarms' }; $VAR5 = 'Flow Diagram'; $VAR6 = { '2' => '\\t \\t \\t \\t& \\mytabhead{Sequence Hold} \\t& Momentary \\t\\\\ \\hline \\n 2 - Flow Diagram - Flow Diagram' }; #### $VAR1 = 'Trend to USB'; $VAR2 = { '0' => 1, '1' => '\\mytabhead{Trend to USB} \\t& \\mytabhead{Start/Stop Trend Toggle} \\t& On/Off \\t\\\\ \\hline \\n 1 - Trend to USB - Old' }; $VAR3 = 'Alarms'; $VAR4 = { '0' => 3, '1' => '\\mytabhead{Alarms} \\t& \\mytabhead{Alarm Trigger} \\t& Momentary \\t\\\\ \\hline \\n 1 - Alarms - Trend to USB' '2' => '\\t \\t \\t \\t& \\mytabhead{Alarm Acknowledge} \\t& On/Off \\t\\\\ \\hline \\n 2 - Alarms - Alarms' '3' => '\\t \\t \\t \\t& \\mytabhead{Alarm Reset} \\t& On/Off \\t\\\\ \\hline \\n 3 - Alarms - Alarms' }; $VAR5 = 'Flow Diagram'; $VAR6 = { '0' => 3, '1' => '\\mytabhead{Flow Diagram} \\t& \\mytabhead{Sequence Advance} \\t& Momentary \\t\\\\ \\hline \\n 1 - Flow Diagram - Alarms' '2' => '\\t \\t \\t \\t& \\mytabhead{Sequence Hold} \\t& Momentary \\t\\\\ \\hline \\n 2 - Flow Diagram - Flow Diagram' '3' => '\\t \\t \\t \\t& \\mytabhead{Sanitize Enable/Disable} \\t& On/Off \\t\\\\ \\hline \\n 3 - Flow Diagram - Flow Diagram' };