#!/usr/bin/perl -w use strict; my $pid; &start_gnuplot; sub start_gnuplot{ $pid = open(GP, "| '/usr/bin/gnuplot' 2>&1 "); syswrite(GP, "plot sin(x)\n"); sleep 2; syswrite(GP, "plot tan(x)\n"); sleep 2; syswrite(GP, "quit\n"); }