interfacing with Perl script

E

ela

As I have written a perl script so no need to reinvent the wheel but can
anybody suggest me how to interface?

#!/bin/sh

for (( i = 1 ; i <= 19; i++ ))
do
ref=$i;

while [ "$*" != "" ]
do
input="$input $indir/$1/sff/*.sff ";
shift
done

runprog $ref $input

#
based on the generated file & takes the statistics on it
$numarray="perl $ref.output";

done

#
print the statistics into a file
print OUTFP $numarray;

e.g.

file 1
66\t38\n
61\t33\n
87\t20\n

file 2
....

then I'll use excel to plot a graph

#
 
J

Jürgen Exner

ela said:
As I have written a perl script so no need to reinvent the wheel but can
anybody suggest me how to interface?
[snipped confusing description]

I have no idea what you are actually trying to do here, but Perl
provides all the usual inter-process communication methods that you
would expect from any other programming language.
Therefore whatever interface your other process has, chances are very
high that your Perl program can hook into that interface.

jue
 
C

cartercc

As I have written a perl script so no need to reinvent the wheel but can
anybody suggest me how to interface?

Ordinarily, you can do this in three steps:
1. read in the file,
2. transform the data, and
3. write out the file.

If you write out the file in a character delimited format, you can
open it in Excel and create any type of chart that you want. However,
from the appearance of your data, it seems that you are already there.

Here is a general template that you can use:

open INFILE, "<my_in_file" or die "$!";
open OUTFINE, ">my_out_file" or die "$!";
while (<INFILE>)
{
chomp;
@line = split /splitchar/;
printf OUTFILE "%c, %s, %d, %.2f%%\n",
$line[0], $line[1], $line[2]+14, $line[3]/2*100;
}
close OUTFILE;
close INFILE;

CC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top