I'm not sure I captured exacttly which min and max you wanted, but this code should get you started on the right track:
use strict;
use warnings;
my %timing1;
my %minmax;
chomp ($_=<DATA>); # Hdr
my @hdr = split /\s+/; # Not used
while (<DATA>){
chomp ;
s/^\s+//;
my @r=split /\s+/;
$timing1{$r[1]}{$r[2]}{$r[3]}{$r[0]}=$r[4];
$minmax{"$r[3]"}{MIN} ||= 9e9;
$r[4] < $minmax{$r[3]}{MIN} and do{$minmax{$r[3]}{MIN} = $r[4]; $min
+max{$r[3]}{MINNAME} = $r[0]};
$minmax{$r[3]}{MAX} ||= -9e9;
$r[4] > $minmax{$r[3]}{MAX} and do{$minmax{$r[3]}{MAX} = $r[4]; $min
+max{$r[3]}{MAXNAME} = $r[0]};
}
foreach my $rName ( keys %timing1 ) {
foreach my $tType ( sort keys %{$timing1{$rName}}) {
foreach my $rF ( sort keys %{$timing1{$rName}{$tType}}){
+
my @by_val = map {[$timing1{$rName}{$tType}{$rF}{$_},$_]}
+
keys %{$timing1{$rName}{$tType}{$rF}};
@by_val = sort { $a->[0] <=> $b->[0]} @by_val;
foreach my $aref ( @by_val) {
my ($val, $pinName) = @$aref;
print " $pinName\t $rName\t $tType\t $rF\t $val \n";
}
}
}
}
# Min and Max ...
for my $k (sort keys %minmax){
print " $minmax{$k}{MINNAME} $k \t Min=", $minmax{$k}{MIN},
"\t $minmax{$k}{MAXNAME} Max=", ($minmax{$k}{MAX} ) ,
"\t Spread=", ($minmax{$k}{MAX} - $minmax{$k}{MIN} ) ,
"\n";
}
__DATA__
pin Name related_pin time_type rise_fall delay
DQ5_RX_CLK M2CLKP c_rise rise_transition 0.014446
DQ2_RX_CLK M2CLKP c_rise rise_transition 0.014464
DQ0_RX_CLK M2CLKP c_rise rise_transition 0.014452
DQ3_RX_CLK M2CLKP c_rise rise_transition 0.014452
DQ7_RX_CLK M2CLKP c_rise rise_transition 0.014430
DQ4_RX_CLK M2CLKP c_rise rise_transition 0.014446
DQ8_RX_CLK INT_CLK c_fall fall_transition 0.199360
DQ6_RX_CLK INT_CLK c_fall fall_transition 0.199322
DQ1_RX_CLK INT_CLK c_fall fall_transition 0.199500
DQ5_RX_CLK INT_CLK c_fall fall_transition 0.199248
DQ2_RX_CLK INT_CLK c_fall fall_transition 0.199368
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
|