develooper Front page | perl.beginners | Postings from October 2009

A question on filehandles

Thread Next
From:
ANJAN PURKAYASTHA
Date:
October 28, 2009 15:00
Subject:
A question on filehandles
Message ID:
f03f40920910281500y3ba7af1fta7ef920a57c4ae61@mail.gmail.com
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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About