#!/usr/bin/perl # # This demonstrates a method of writing format-ed output into # variables under Perl 4. # # mjd-perl-lod@plover.com format OUT = @<<<<<<<<< | @|||||||||| | @>>>>>>>>>> @#####.## $left, $center, $right, $numeric . $numeric = 11; unless ($ARGV[0] eq 'receive') { close STDIN or die "close STDIN: $!"; pipe(STDIN, OUT) or die "pipe: $!"; for ($i=0; $i<7; $i++) { ($left, $center, $right) = split /\s+/, scalar ; write OUT; $numeric *= 2 / 3; } close OUT; exec "./$0 receive"; die "exec: $!"; } # Read formatted data from standard input @formatted = ; 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.