This modification to your code:
use strict; use warnings; while(<DATA>) { chomp($_); if ($_ =~ m/\[(\d{4}\/\d{2}\/\d{2}\s+\d{2}\:\d{2}\:\d{2})\]\s+\[(\ +d{1,3})\]\s+ERRORMSG\s+(.*)/) { my $date = $1; my $err_no = $2; my $err_msg = $3; if ($. > 1) { print qq{\n}; } print "$date === $err_no === $err_msg"; } else { print qq{ $_}; } } print qq{\n};
produces this output:
ken@ganymede: ~/tmp $ pm_multiline_regex.pl 2012/02/16 00:08:34 === 29 === unknown error Can't insert into price +table Please check Valueprice.pm line 52. 2012/02/16 00:08:34 === 39 === Invalid User 2012/02/16 00:14:52 === 105 === missing conversion rate 2012/02/16 00:14:52 === 29 === Can't use an undefined value as a HASH + reference at Value.pm line 77. ken@ganymede: ~/tmp $
-- Ken
In reply to Re: Not able to capture information
by kcott
in thread Not able to capture information
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |