Hi,
Iam unable to debug this code.
pls help me.
here is the code :

open(FILE,"build.txt") ||die "cannot open \n";
print "select which build you want to enter\n";
$build=<STDIN>;
while(<FILE>)
{
        if(/$build/)
                {
                print "you selected $build\n";
                #here it should print next 3 0r 4 lines until space comes
                }
        else
        {
        print "$build is not found\n";
        }
}

If build1 is found it should print next 3 lines (or till space comes)

for ex build.txt file :
build1
rpm_1;
rpm_2;
qwe_3;

build2
qwe-1;
asd_2;
asd_3;
-----Original Message-----
From: Prasanthi Tenneti [mailto:[EMAIL PROTECTED]]
Sent: 18 November, 2001 12:43
To: [EMAIL PROTECTED]
Subject: pattern matching


Hi,
Iam a beginner in perl.I have one question,
Iam trying to write one prog,in which i have to search for one word in a
file,
If I found that word,print next 4 lines.
PLs help me,how to write code.
cheers,
prasa.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to