How do I output an array twice via pipe instead of only once?



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

.



Relevant Pages

  • Re: Logon script - function array and select case not working
    ... this all works well, except, the function i am using for the rules in the control script causes alot of querrys to AD. as there are alot of groups. ... objTSout.writeline retrv ... So if you think that this will assign an array value to the variable, how do you think the case select statement is going go compare this array value with the literal string values such as "group name here"? ... However, by not assigning ANY value to checkgrp in the function, you are guaranteeing that, should the function ever exit, it will return no information. ...
    (microsoft.public.scripting.vbscript)
  • Re: string retrieval issue
    ... Chicago Bears|NFC North ... not writing the third element back to the array). ... You didn't include it in your script. ... Fear is the mind-killer. ...
    (comp.lang.perl.misc)
  • Re: How do I output an array twice via pipe instead of only once?
    ... second script. ... array, my script sends them both over at the same time. ... keeps waiting until it does receive a newline (or it receives end-of- ...
    (perl.beginners)
  • Re: even rows for checkbox forms with no splitting of boxes from values
    ... 'mod' on the array length with a denominator equal to the width of the row, ... State saving really depends on what the script is already doing. ... So I usually roll my own checkboxes. ... #this is to create an array with 25-50 strings 2-10 in length ...
    (comp.infosystems.www.authoring.cgi)
  • Re: settimeout needs alert() ???
    ... function slider { ... and use script to replace the src and title attributes. ... are downloaded completely. ... The usual strategy is to load all of the images in to an array of image ...
    (comp.lang.javascript)