$bins = int(($keys[$#keys]-$keys[1])/$histowindowsize); ###histowindowsize is some integer (i have tried 1000 and got errors) my $graph = new GD::Graph::histogram(800,600); $graph -> set( x_label => 'Hash's Keys', y_label => 'count of keys in file', title => 'Key count histogram', histogram_bins => $bins, x_labels_vertical => 1, bar_spacing => 0, shadow_depth => 1, shadowclr => 'dred', transparent => 0, ) or warn $graph -> error; my $gd = $graph -> plot (\@keys) or die $graph->error; open (IMG, '>histo.png') or die $!; binmode IMG; print IMG $gd -> png;