Re: How do I output an array twice via pipe instead of only once?
- From: junk2junk@xxxxxxxxxxx
- Date: 30 Jan 2007 11:26:20 -0800
The solution: I noticed a few inconsistent results that still occured
occasionally but not every time I ran it. I think another issue
(perhaps THE issue) was my slack usage of "open". I added a couple
extra open and close statements which solved that. I was able to leave
b.pl as to how I had it originally (for other reasons). Here is my
final working version of a.pl and b.pl:
Now I'm happy!
#!/usr/bin/perl -w
#
# a.pl
#
open(OUTPUT,"|b.pl");
@array1=("A","B");
print OUTPUT "@array1", "\n";
close(OUTPUT);
open(OUTPUT,"|b.pl");
@array2=("C","D");
print OUTPUT "@array2", "\n";
close(OUTPUT);
----------------------------------------------
#!/usr/bin/perl -w
#
# b.pl
#
@input=<STDIN>;
print "here is the inputted array: @input \n";
-----------------------------------------------
Output:
here is the inputted array: A B
here is the inputted array: C D
-----------------------------------------------
.
- References:
- How do I output an array twice via pipe instead of only once?
- From: junk2junk
- Re: How do I output an array twice via pipe instead of only once?
- From: Paul Lalli
- Re: How do I output an array twice via pipe instead of only once?
- From: Paul Lalli
- Re: How do I output an array twice via pipe instead of only once?
- From: nobull67@xxxxxxxxx
- How do I output an array twice via pipe instead of only once?
- Prev by Date: Perl X file
- Next by Date: Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])
- Previous by thread: Re: How do I output an array twice via pipe instead of only once?
- Next by thread: Re: How do I output an array twice via pipe instead of only once?
- Index(es):