#!/usr/bin/perl -w use strict; use warnings; use GD::Graph::lines; print "Content-type: text/html\n\n"; &main(); ############################# sub main() { ############################# my @data = ( ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th"], [1, 5, 6, 7, 3.5, 2, 3, 4.5, 4.5], [1, 2, 5, 6, 3, 1.5, 1, 3, 4], [ sort { $a <=> $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ] ); my $graph = GD::Graph::lines->new(400, 300); $graph->set( x_label => 'X Label', y_label => 'Y Label', title => 'Some simple graph', y_max_value => 8, y_tick_number => 8, y_label_skip => 2 ) or die $graph->error; my $format = $graph->export_format; open(IMG, ">graph_lines.$format") or die $!; binmode IMG; print IMG $graph->plot(\@data)->$format(); close IMG; print qq~graph_lines.$format~; }