Advertisement

07.17.2008 at 01:00PM PDT, ID: 23574727
[x]
Attachment Details

Regex not assigning a value to a variable

Asked by holein5 in Perl Programming Language

Ok, I'm assigning 500 to what should be an easy question but 1) I need it quickly, and 2) it's driving me nuts.

Why doesn't "Event Log Watcher" get assigned to $process in the script below.  I only get "Event Log".

#!/perl

use warnings;
use strict;

my $trap = 'Host:Windows_NetServer Windows_NetServer caiWinA3 Poll WinA3_ProcInst OK Critical Event Log Watcher';
my $regex = '.*ProcInst\s+(?:Warning|Critical|OK|Unknown|Repaired|Up)\s+(?:Warning|Critical)\s+(.*)';
( my $process ) = $trap =~ / $regex /;
print $process;
exit;Start Free Trial
[+][-]07.17.2008 at 01:45PM PDT, ID: 22030095

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Sign Up Now!
Solution Provided By: FishMonger
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.17.2008 at 01:48PM PDT, ID: 22030127

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628