> But exec's needlessly. Oh, gosh! > Sorry MJD, but you missed the mark on this one. Yeah, I just found a new hammer, and I'm going around hammering everything in sight, even stuff that doesn't need hammering. > If you can write it all into a pipe buffer, you can read it in the > same process. If you omit the exec, you do better than that: You can alternate the writes and the reads, so that only each line of output needs to fit in the pipe. That is a lot more likely than fitting the total of all the data into the pipe. Then the program looks like this: #!/usr/bin/perl # # This demonstrates a method of writing format-ed output into # variables under Perl 4. # # mjd-perl-lod@plover.com format F_OUT = @<<<<<<<<< | @|||||||||| | @>>>>>>>>>> @#####.## $left, $center, $right, $numeric . pipe(F_IN, F_OUT) or die "pipe: $!"; select((select(F_OUT),$|=1)[0]); for ($i=0; $i<7; $i++) { ($left, $center, $right) = split /\s+/, scalar <DATA>; write F_OUT; push @formatted, scalar <F_IN>; $numeric *= 2 / 3; } for ($i = 0 ; $i < @formatted; $i++) { print "STDIN $i: $formatted[$i]"; } __DATA__ In the beginning God created the heavens and the Earth. The Earth was without form and void, and darkness was upon the face of the deep. This works really well. You could probably even install it as a subroutine or something. ==== Want to unsubscribe from this list? (Don't you love us anymore?) ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org