Thanks for ur reply.. I tried with above code.. but still im not able to get the min and max values correctly. only 2 hash variables Please find the code
Output should bemy %hash; open my $fh, '<', $file or die "Could not open '$file' $!"; while(<$fh>) { chomp(); if(/SQL:: (.*),Time Taken:: (.*)/i) { #print "$1=$3\n"; $hash{$1}->{count}++; $hash{$2}->{total} +=$2; if(defined $hash{$2}->{min}) { if ($hash{$2}->{min} > $2) { $hash{$2}->{min} = $2; } } else { $hash{$2}->{min} = $2; } if(defined $hash{$2}->{max}) { if ($hash{$2}->{max} < $2) { $hash{$2}->{max} = $2; } } else { $hash{$2}->{max} = $2; } } else { print "not matching\n"; } } print Dumper \%hash;
SQL No of occu Min Max select * from person 3 10 50 select * from emp 2 5 30
In reply to Re^2: To find the no of occurenaces and max min value
by Madhavan11
in thread To find the no of occurenaces and max min value
by Madhavan11
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |