It appears that the strings you want are separated by whitespace, have no whitespace embedded and $text is in a consistent format. If this holds true, I would split $text on whitespace, then extract the strings you want from the array.
if ($text =~ /FATAL: Error ... /){ my @parts = split /\s+/, $text; my $dt = "$parts[0] $parts[1]"; my $msg = $parts[6]; my $source = $parts[8]; my $destination = $parts[10]; ... }
In reply to Re: Alternatives for index() ... substr() ?
by Anonymous Monk
in thread Alternatives for index() ... substr() ?
by zarath
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |