sreek3502 has asked for the wisdom of the Perl Monks concerning the following question:
Hi experts,
I have a perl program, wherein i have declared array variable to match the regex and get the desired value but it working locally in strawbery perl but not in the server. can you please check and advise.
open(QUEUES, $queuecmd); my @lines=<QUEUES>; close QUEUES; my @queues = grep {s/.*count= *(\d+),.* Queue=or_event_queue\s*/$1/} @ +lines; print "$queues[0]\n";
In the above program @queues did not get the correct value. Below is the $queuecmd command output read in to @lines
Host 'server02' connected ============================================================ Hostname: 'server02' count= 0, delivering= 0, Queue=opr_action_launch_queue count= 0, delivering= 0, Queue=queue/alert_engine_notificat +ion count= 3079, delivering= 0, Queue=or_event_queue count= 0, delivering= 0, Queue=recipient_notification count= 0, delivering= 0, Queue=queue/alert_engine_alert count= 0, delivering= 0, Queue=failed_recipient_notificatio +n
@queues and $queues[0] should have value 3079
Thanks and regards,Discipulus added code tags where needed
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Did not get the regex matched value in perl array variable
by choroba (Cardinal) on Dec 27, 2017 at 08:16 UTC | |
|
Re: Did not get the regex matched value in perl array variable
by thanos1983 (Parson) on Dec 27, 2017 at 09:41 UTC | |
by soonix (Chancellor) on Dec 27, 2017 at 13:01 UTC | |
by thanos1983 (Parson) on Dec 27, 2017 at 14:15 UTC | |
|
Re: Did not get the regex matched value in perl array variable
by Marshall (Canon) on Dec 28, 2017 at 00:54 UTC | |
by Laurent_R (Canon) on Dec 28, 2017 at 13:39 UTC |