Hay Madhavanll,
You should not use $2 has key in %hash, please find the modified code.
Please use code tag to post you code.
use strict;
use warnings;
use Data::Dumper;
my $file = './data.txt';
my %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{$1}->{total} +=$2;
if(defined $hash{$1}->{min})
{
if ($hash{$1}->{min} > $2)
{
$hash{$1}->{min} = $2;
}
}
else
{
$hash{$1}->{min} = $2;
}
if(defined $hash{$1}->{max})
{
if ($hash{$1}->{max} < $2)
{
$hash{$1}->{max} = $2;
}
}
else
{
$hash{$1}->{max} = $2;
}
}
else
{
print "not matching\n";
}
}
print Dumper \%hash;