in reply to gd::graph returns unicode
According to the author, the use of @data is legacy code. I rewrote it to reflect the newer usage. Note that the
usual way to print is...
The full script:open(IMG, '>test.png'); binmode IMG; print IMG $gd->png;
#!/usr/bin/perl -l use strict; use warnings; use GD::Graph::bars; use GD::Graph::Data; print "Hello world!\n"; my $data = GD::Graph::Data->new([ [1,2,3,4], [5,3,8,9], ]) or die $!; my $graph = GD::Graph::bars->new(); $graph->set( x_label => 'X num', y_label => 'Y num', title => 'Test', ) or die $graph->error; my $gd = $graph->plot($data) or die $!; open(IMG, '>test.png'); binmode IMG; print IMG $gd->png;
In Section
Seekers of Perl Wisdom