while () { last if /^$/; $from = "$1" if /^From:(.+)$/; $subject = "$1" if /^Subject:(.+)$/; } while () { push @message, $_; }