Trying to learn how to run Gnuplot via a Perl script I came across the
following helpful example:

#!/usr/bin/perl
# Generate postscript and png plot with GNUplot from Perl
# Author: Ioan Vancea
# Usage: Give "data file" as an argument for script

use strict;
use warnings;

my $file = ARGV[0];

# POSTSCRIPT
open (GNUPLOT, "|gnuplot");
print GNUPLOT <<EOPLOT;
set term post color "Courier" 12
set output "$file.ps"
set size 1 ,1
set nokey
set data style line
set xlabel "frequency" font "Courier,14"
set title "Fast Fourier Transform" font "Courier,14"
set grid xtics ytics
set xtics 100
plot "$file" using 1:2 w lines 1
EOPLOT
close(GNUPLOT);

A filehandle to run a program ?!! And what is that pipe symbol doing there?
Would appreciate any pointers to how this works or where I can read up
about this.

TIA,
Anjan



-- 
=============================
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142

purkayas [at] wi [dot] mit [dot] edu
703.740.6939

Reply via email to