Steve Bertrand wrote:

if (/.*simscan~\[\d+\]~([\w|\s]+).*?~(\d+\.\d+)s~.*?~(.*?)~(.*?)~(.*)/) {
-------------------------^^^^^^^^^^
This captures the "result", but with a trailing space. You may want to let the capturing parentheses be followed by \s to prevent that.

                $result   = $1 if $1;
                $scantime = $2 if $2;
                $ip       = $3 if $3;
                $from     = $4 if $4;
                $to       = $5 if $5;

The statement modifiers seem redundant to me.

Did you consider using split() ?

while (<LOG>) {
    chomp;
    my ($result, $scantime, $ip, $from, $to)
      = ( split /~/ )[2,3,5..7] or next;

    $result =~ s/\s+\(.+//;
    chop $scantime;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to