Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to read that data file and read the lines which don't contains (....) , however inside the loop I don't want to loop for every single line. in other words ,, forexample how would I read what is between (CSW - Q1) and (CSW - Q2) only without printing (CSW - Q1) and (CSW - Q2) , right now I have the following :(CSW - Q1) OMIPMS55:NTTCSWQ1:MQSI.3PL846 OMIPMS55:NTTCSWQ1:MQSI.STATUS OMIPMS55:NTTCSWQ1:MQSI.3PLXDOCK.STATE (CSW - Q2) OMIPMS55:NTTCSWQ2:MQSI.3PL846 OMIPMS55:NTTCSWQ2:MQSI.3PL944 (CSW - Q3) OMIPMS55:NTTCSWQ3:MQSI.3PL846
this will print all lines and it will loop foreach line , I want it to treat what is between (***) till the next (**) as one group and not go through the loop for every time . If I am not making sense please let me know I will try to explaing better ,, thanks in advance .open (INPUT, "data") || die "couldn't open the file!"; open (OUTPUT, ">result.out") || die "couldn't open the file!"; foreach $line (<INPUT>) { chomp $line; if ( $line !~ /^\[.*\]/ ) { ($server, $queuem, $queue)= split(/:/, $line); system qq(telnet -host $server -user mqadmin -passwd >> out); } } close(OUTPUT); close(INPUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: matching some lines
by GrandFather (Saint) on Nov 12, 2007 at 22:14 UTC | |
|
Re: matching some lines
by CountZero (Bishop) on Nov 12, 2007 at 21:40 UTC |