Calling Gnuplot from Perl

Tue 30 September 2008

In my previous post I discussed how to call Gnuplot from C and Python language. If you are using Perl, then, here is the script:

    #!/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 <