my (@h,@c); push @h, $_->{hour} foreach(@{$data}); # no so great push @c, $_->{count} foreach(@{$data}); # see extremely's comment my $new = [ \@h, \@c ]; $gd = $graph->plot($new); # wrong - see orbital's comment