how to delete

lbdev
lbdev used Ask the Experts™
on
I have an email message in the array @msg (each element is a line of the email).  I want to strip out everything before the first empty line, also stripping that empty line.  There are a variable amount of lines before the first empty line.

What is the most efficient way to do this (shift through the array?)

Thanks

P I 21-07-2009 02:58:43 0000 ____ ____ <notice@whatever.com>
A email.host.net [288.149.118.12]
S SMTP [109.2.201.221]
R W 21-07-2009 02:58:44 0000 ____ _FY_ <sdfasad@somehost.net>
 
 
Received: from somehost ([22.2.222.222] verified)
  by myhost.net (CommuniGate Pro SMTP 5.1.8)
  with ESMTPS id 209182505 for user@myhost.net; Mon, 20 Jul 2009 21:58:44 -0500
Message-Id: <200907210255.n6L2tfZV087630@host>
Reply-To: <user@gmail.com>
From: "Mr. Ron Mills"<user@gmail.com>
Subject: Ministry of Finance' ATM CARD approval.
Date: Mon, 20 Jul 2009 19:57:00 -0700
 
 
Dear user,
 
Here is your email text.
 
Thanks.

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ozo
Most Valuable Expert 2014
Top Expert 2015

Commented:
@msg= grep{(!/\S/..0)>1}@msg;
Most Valuable Expert 2014
Top Expert 2015
Commented:
1 while (shift @msg)=~ /\S/;

Author

Commented:
Perfect!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial