bowei_99 has asked for the wisdom of the Perl Monks concerning the following question:
The offending line 82 is the assignment of the regexp output below:Array found where operator expected at check.pl line 82, at end of lin +e (Missing operator before ?)
where the regexp is:if (@data = ($line =~ STATUS_COMPLETED_RE )) { $stats{level} = $shift @data; $stats{group} = $shift @data; $stats{total} = $shift @data; }
The code works if I don't output to an array, but since I don't know big the resulting match list from the regexp will be, I'd prefer to dump it to an array and process that array. In other words, the Details section from the regexp could be large, and I'm trying to make it robust.use constant STATUS_COMPLETED_RE => qr{ ^string-here \s string-here: \s \((\w+)\) \s #alarm level ([\w|\s]+) \s completed, \s #job completed Total\s (\d+) \sclient\(s\), \s #total client +s ( #Details - (\d+) \s # number ([\w|\s\(\)]+) ,|\. # su +cceed,fail,etc. )* # any numbe +r of }xms ;
-- Burvil
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Assign regexp output to array not working
by betterworld (Curate) on Aug 09, 2008 at 23:52 UTC | |
Re: Assign regexp output to array not working
by Cristoforo (Curate) on Aug 10, 2008 at 02:40 UTC | |
Re: Assign regexp output to array not working
by GrandFather (Saint) on Aug 09, 2008 at 23:54 UTC | |
Re: Assign regexp output to array not working
by converter (Priest) on Aug 10, 2008 at 00:26 UTC |