On 9/2/07, Chas Owens <[EMAIL PROTECTED]> wrote: > On 9/2/07, Chris E. Rempola <[EMAIL PROTECTED]> wrote: > > Thanks for all your help thus far. If I wanted to view the numbers to > > the right of the pound sign(#) also, how would I go about doing that? > > Is creating another value to the key the right idea? > snip > > if ( /#.*\d+\s+\d+\s+(\S*)/ ) { > > $key = $1; > snip > > Depending on what you want to do with the data you can either grab the > both numbers and the email address like this > > if (/#(\d+\s+\d+\s+\S+)/) { > $key = $1 > > or you can grab them individually like this > > if (/#(\d+)\s+(\d+)\s+(\S+)/) { > my ($num1, $num2, $email) = ($1, $2, $3); >
However, I must reiterate that this is just a bandaid. The proper solution is to create a parser for the whole file format. With that in hand you could extract any information you needed from the file. You can see that you will eventually need this by the fact that your requirement has gone from the just the email address to the email address and the two numbers before it. The log is a structured file, and it should be read in a structured way. Throwing together a quick regex to get the info you want is fine in the short term, but it is inexact (as you have seen from the fact that bounces broke the regex) and hard to extend (as you can see from the from the fact that you now need to change the regex to get the numbers before the email). We also may be reinventing the wheel as there is something that looks like it is doing it already: http://search.cpan.org/~msimerson/Mail-Toaster-5.05/lib/Mail/Toaster/Logs.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/