How do I output an array twice via pipe instead of only once?
- From: junk2junk@xxxxxxxxxxx
- Date: 30 Jan 2007 09:13:07 -0800
I have a script that outputs an array which gets used as input in a
second script. The problem is that if I want to send over a second
array, my script sends them both over at the same time. It seems like
perl is trying to be too efficient. Here are the simplified scripts:
#!/usr/bin/perl
#
# a.pl
#
open(OUTPUT,"|b.pl");
@array1=("A","B");
print OUTPUT @array1;
@array2=("C","D");
print OUTPUT @array2;
---------------------------------------------------
#!/usr/bin/perl
#
# b.pl
#
@input=<STDIN>;
print "here is the inputted array: @input \n";
-----------------------------------------------------
What the script displays is:
here is the inputted array: ABCD
-----------------------------------------------------
But what I want is:
here is the inputted array: AB
here is the inputted array: CD
-----------------------------------------------------
Thanks,
Jim
.
- Follow-Ups:
- 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?
- Prev by Date: Re: confusion with splitting columns using [-n, -n] (e.g; my ( $country, $bytes ) = ( split )[ -2, -1 ])
- Next by Date: Re: How do I output an array twice via pipe instead of only once?
- Previous by thread: SQL Server Connectivity
- Next by thread: Re: How do I output an array twice via pipe instead of only once?
- Index(es):
Relevant Pages
|