#!/usr/bin/perl use Mail::Internet; $msg = Mail::Internet->new([ <> ]); $to = $msg->get('To'); #$content = join( '',@{$msg->body} ); @content = @{$msg->body}; print "To: " . $to; foreach $line (@content) { @words = split(/ /, $line); foreach $word (@words) { if ($word =~ /blah/) { $word = "something"; } print "$word "; } }