Very minor thing s/piont_datas/point_datas/g;. The only reason the code doesn't generate an error is because you made this spelling mistake consistently.
What is the last line doing? $hmap->matrix simply returns a reference to the density matrix - on its own it does nothing.
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)
Thanks for finding my mistake. Now, I am getting the heatmap image in my $img variable i.e $img = $hmap->draw;
But how to use this $img value to get image in gif/png format.
Because there is no plot option defined in Imager::Heatmap module.