#!/usr/bin/perl use warnings; if (not defined $ENV{MSGFILTER_PREV_MSGID}) { while (<>) { print $_; } exit; } my $first = 1; if (("%s: " . $ENV{MSGFILTER_MSGID} . "\n") eq $ENV{MSGFILTER_PREV_MSGID}) { while ($l = <>) { if ($first) { $l =~ s/^%s: (.*)/$1/; $first = 0; } $l =~ s/\n$// if eof(STDIN); print $l; } } else { while (<>) { print $_; } exit; }