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 :)


In reply to Using piped I/O? by newbie1991

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.