If the layout is fixed (that is if the data changes but the position of the data does not change, then try this:
$_='May 2 04:06:15 lon.mail.net exim: 2012-07-03 07:06:15 1SPP
+tO-0004en-PS <= firstname.lastname@example.org H=smtpout.mail.com [18.104.22.168] I=[6.5.1
+4.4]:25 P=esmtp S=13333 id=6aeca3b79b8892d6105dab131c76f066@localhost
+.localdomain T="Half price offer"';
my @data= split(/ /);
print "Email: $Email\n";
print "IP: $IP\n";
As you are limited to Perl 5.8.4, regex's are not as fast as in 5.10 and up so I would try to limit the data I perform a regex on as you never know what will change and cause your program to bomb (usually at 3:00am on a Sunday morning). I would split your data into its many parts and then run what ever regex you need on a smaller data chunk. For the email you don't even need a regex. The square brackets can be removed in any number of ways, I choose the lazy way in my example.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||