Hello,
When reading from <STDIN> like that, you're going to want to use chomp to
remove the \n line character at the end of what the user inputs. Right now,
you're actually doing a match for "$build\n".
So, you could change "$build=<STDIN>;" to "chomp($build=<STDIN>);" or even
"chomp($build=<>);".
HTH.
-Dave
On Wednesday 21 November 2001 09:32 am, Prasanthi Tenneti wrote:
> 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;
>
> if I selected build1 ,it should print rpm_1 to qwe_3
> cheers,
> prasanthi.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]