#!/usr/bin/perl

format TOP =
Camel Fight Digest                          @>>>>>>>>>>>>>>>>>>
					    $date

Who                                   Winner
FOOTER
@<<<<<<<<<<<<<<<<<           @|||        @>>>>>>>>>>>>>>>>>>>>>
$sponsor                      $%         $whose_pool
FOOTER
.

format OUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<    @<<<<<<<<<<<<<<<<<<<<<<<<
$who                                  $winner
.

# Open pipe to a child.

$pid = open(OUT,"|-");
if (!$pid) {                        # We're the child process.
    $/ = "\f";                      # Slurp entire page in.
    $* = 1;                         # Multi-line pattern match.
    while (<STDIN>) {
	($head,$foot,$body) = split(/^FOOTER/);
	print $head,$body,$foot;    # Rearrange page's anatomy.
    }
}
else {                              # We're the parent process.
    select(OUT); $^ = 'TOP'; $~ = 'OUT';
    while (<INPUT>) {
	# Your code here.
	write(OUT);                 # Pretend footer is header.
    }
}
