newbie1991 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks! I have a two part question: ONE : I'm writing a program where it has to scan for all files of a particular extension and continue working with them. For example, all *.pep files are to be processed in some way. Since the file is pretty large, I'd like the piped input to be read into an array and not a scalar. Initially I was using the filename from user input, like so :
print "Enter the name of the files containing all the proteomic inform +ation: \n"; my $filename = <STDIN>; unless( $filename =~ /\.pep?$/) #Checking if the file extension is .pep { die "File is not .pep file. Exiting. \n"; } open (DATA, $filename) or die "Cannot open $filename!\n"; my @arraydata = <DATA>; #all the information in the pep file is input into an array
How do I convert this to using pipes? Is it simply:
open(DATA, '| >*.pep');
TWO I want to use the output from this program as input for another program. Can this be done by just modifying the data input 'open' line in the other program? This is my first program using pipes so I'd appreciate your help. Thanks :)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using piped I/O?
by daxim (Curate) on Feb 05, 2013 at 11:56 UTC | |
Re: Using piped I/O?
by BrowserUk (Patriarch) on Feb 05, 2013 at 12:31 UTC | |
Re: Using piped I/O?
by Anonymous Monk on Feb 05, 2013 at 10:34 UTC | |
Re: Using piped I/O?
by jwkrahn (Abbot) on Feb 05, 2013 at 10:38 UTC |