use strict; open( my $fout, ">myplot.gpt" ) or die( "Problem: $!" ); print( $fout <<'EOF' ); reset set terminal png size 320,160 medium set output 'myplot.png' set title "Test Plot" set xrange [0:5] set yrange [0:100] plot [0:5] "-" using 1:2 title "Distance" with lines 1.0 20 2.0 40 3.0 40 4.0 80 end EOF close( $fout ); my $result = `gnuplot myplot.gpt`; print( $result ) if ( $result );