in reply to (jeffa) Re: Question about using hash indexes with GD::Graph
in thread Question about using hash indexes with GD::Graph

This is perfect except that I had to cange the foreach lines to look like follows.
my (@h,@c); push @h, $_->{'hour'} foreach(@data); push @c, $_->{'count'} foreach(@data); my $new = [ \@h, \@c];
Now it is graphing correctly

Replies are listed 'Best First'.
Re: Re: (jeffa) Re: Question about using hash indexes with GD::Graph
by merlyn (Sage) on Mar 20, 2001 at 21:23 UTC
    Any kind of push @x, .... for @y should immediately invoke that magic three-letter word, "m a p".
    my $new = [ [map $_->{hour}, @data], [map $_->{count}, @data] ];

    -- Randal L. Schwartz, Perl hacker

      Man, I was *this* close to getting that. Nice! Thanks once again, Randal!

      Jeff

      R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
      L-L--L-L--L-L--L-L--L-L--L-L--L-L--