script: while(my $msg = Mail::Message->read(\*STDIN)) { $msg->write if $want_to_keep_it; } ./script smaller