Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Trying to sort output

by Kenosis (Priest)
on Feb 24, 2013 at 01:08 UTC ( #1020369=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Trying to sort output
in thread Trying to sort output

Here's a variant that doesn't require List::Util, as you can grep the captured seconds for values greater than or equal to a limit. The m modifier's not needed in the regex, since \s+ will match across lines:

#!/usr/bin/perl use strict; use warnings; my $limit = 1001; my $rundsm = `dsmadmc -id=reports -pa=reports q proc`; if ( isIssue( $limit, $rundsm ) ) { print "Message: Issue Found, Alert Operations\n", "Statistic: 1\n" +; exit 1; } else { print "Message: No Issues Found\n", "Statistic: 0\n"; exit 0; } sub isIssue { my ( $limit, $data ) = @_; return grep $_ >= $limit, $data =~ /\((\d+)\s+?seconds\)/g; }


Comment on Re^3: Trying to sort output
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020369]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-07 03:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls