#!/usr/local/bin/perl use strict; use warnings; use IPC::Open2; use constant HEADER => < <, FOOTER or exit 2; close TEXOUT; open IMAGEOUT, ">", $imageFile or exit 3; print IMAGEOUT or exit 4; close IMAGEOUT; close IMAGEIN; waitpid $pid, 0;