Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

line match

Status
Not open for further replies.

superstarjpmc

Programmer
Jan 22, 2004
38
US
Hi,
I have the follwing inside a variable .. basically its the stdout/stderr.
<QUOTE>
Sending request .................
server response .........
received my response ...
I am Analysing response...
-this is the output xx!p:p:9009
-next line is 64
I'm done !
<UNQUOTE>

I'm interested in grabbing the PID ( i.e 9009 ).
Can someone suggest how to go about this ?

regs
DJ
 
How do you get the value in the variable? It's just that it would be easier if you read it into an array of lines
Code:
use strict;
use warnings;

my @stuff = <DATA>;
chomp @stuff;

foreach (@stuff) {
    print "$1\n" if (/p:p:(\d+)$/);
}

__DATA__
Sending request .................
server response .........
received my response ...
I am Analysing response...
-this is the output xx!p:p:9009
-next line is 64
I'm done !
because the matching is less complicated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top