Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Regex and PID issue

by hippo (Bishop)
on Jun 16, 2016 at 21:02 UTC ( [id://1165908]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regex and PID issue
in thread Regex and PID issue

So, add a test for that as well:

#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 2; my $line = 'root 1435 0.0 0.0 147236 7548 ? Ss 08:46 + 0:02 /usr/local/httpd-2.4.16/bin/httpd -k start'; my $processName = 'httpd'; my $owner = 'root'; my ($pid) = $line =~ qr|$owner\s+(\d*)\s+\d.+$processName|; is ($pid, '1435', 'Match'); is ($1, '1435', 'Match');

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-24 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found