#!/usr/bin/perl while(1) { if (!$ARGV || /^IEA/) { $/ = \1; 1 while ($_ = <> || last) =~ /\s/; $/ = \104; die "Interchange can't start with $_" unless ($_ .= <>) =~ /^ISA[^\w\n]/; $/ = \(1 + y/\n//); $/ = substr( ($_ .= <>) , -1); die "Invalid terminator in $ARGV" if /\w$|\n.*\n$/ || ! s!\n|$/!!g; } else { last if !defined (($_ = <>) =~ s!\n|$/!!g); } print "$_\n"; }