bory has asked for the wisdom of the Perl Monks concerning the following question:
And from this file I want to read the values:01,02 and 4TEST,5TEST Here is my code but it doesn't work properly:FIRST Level Description EQT.FIRST.Id: 2 EQT.FIRST.eqtID_01.allowedType: 4TEST EQT.FIRST.eqtID_02.allowedType: 5TEST SECOND Level Description
Thank you for your time.my $data_file = "test.txt"; open(FILE, "< $data_file"); while(<FILE>) { if ( /FIRST Level Description/.. /SECOND Level Description/ ) { if (/EQT.FIRST.eqtID_(\d+).allowedType:([A-Z0-9]+)/) { ($str1,$str2 ) = ($1,$2); } print "$str1 \n $str2"; }}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reading from a text file
by robartes (Priest) on Jun 07, 2005 at 08:05 UTC | |
|
Re: reading from a text file
by ZlR (Chaplain) on Jun 07, 2005 at 08:11 UTC | |
|
Re: reading from a text file
by tchatzi (Acolyte) on Jun 07, 2005 at 08:41 UTC | |
by samy_kumar (Scribe) on Jun 07, 2005 at 12:13 UTC | |
by tchatzi (Acolyte) on Jun 07, 2005 at 14:05 UTC | |
by tchatzi (Acolyte) on Jun 07, 2005 at 14:18 UTC | |
|
Re: reading from a text file
by aukjan (Friar) on Jun 07, 2005 at 08:11 UTC |