[Bioperl-l] how to use pipe in perl script?

Andreas Kahari ak at ebi.ac.uk
Mon Apr 19 07:54:48 EDT 2004


Another solution for another interpetation of the problem:

If you want to do something like

    script1.pl | script2.pl

Then script1.pl should write it's results to standard output
(<STDOUT>, the default for e.g. print()), and script2.pl should
read its input from standard input (<STDIN>).  And that's all
there is to it.


Andreas

On Mon, Apr 19, 2004 at 12:30:48PM +0100, Paulo Almeida wrote:
> You can use the 'system' command to do something like this:
> 
> system("program1 -infile filename | program2");
> 
> If that doesn't work for some reason, you could write the output of the 
> first program to a file, and then open it with the second program.
> 
> system("program1 -infile filename > output");
> system ("program2 < output");
> 
> I hope that's what you wanted, I'm not sure I understood...
> -Paulo Almeida
> 
> Zhou Yu wrote:
> 
> >Hi,
> >
> >How to use pipe in a script, like redirecting the output of a program 
> >to another program in a script?
> >
> >For example, I use this command "program1 -infile filename | program2" 
> >in the command line, and how can I to do this in a script?
> >
> >Thanks!
> >*
> >Yu Zhou*
> >
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l

-- 
|}{}{| Andreas Kähäri      EMBL, European Bioinformatics Institute
|{}{}|                     Wellcome Trust Genome Campus
|}{}{| Ensembl Developer   Hinxton, Cambridgeshire, CB10 1SD
|{}{}| DAS Project Leader  United Kingdom


More information about the Bioperl-l mailing list