#!/usr/bin/perl # # Cut header of SPL in spool folder to raw EMF # sub spl2emf { my $fnm = shift; if ( open my $FO, '>:raw', "$fnm.emf" ) { if ( open my $FI, '<:raw', $fnm ) { read $FI, my $str, -s $FI; my $pos = index $str, ' EMF'; if ( $pos == -1 ) { print "No EMF marker found; probably wrong file\n"; return; } print $FO substr $str, $pos - 40; } } } foreach my $fnm ( @ARGV ) { print "$fnm\n"; spl2emf( $fnm ); }