Operating System - Linux
1753460 Members
4536 Online
108794 Solutions
New Discussion юеВ

Perl Script help for infinite loopand exit for user i/p mismatch

 
SOLVED
Go to solution
anilsingh
Occasional Contributor

Perl Script help for infinite loopand exit for user i/p mismatch

I just want to run 5 perl script from a single one.I wrote the script(attached).Now I want to continue a loop until user press option as "n".I used Do-while llop,but it's not working,i.e,working same for either "y" or "n".
could someone help in this regard?
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: Perl Script help for infinite loopand exit for user i/p mismatch

Hi:

Attached you will find a version that senses your responses. You have mixed "=", "==" and 'eq' operators and forgotten to 'chomp' some of your input. I have maintained your formatting style so you can see what and where changes were made.

You should ALWAYS set the 'strict' and the 'warnings' pragmas. You will save yourself considerable grief in debugging silly mistakes.

Lastly, a 'do...while' or 'do..until' in Perl is not nearly as powerful as a 'while...do' loop since 'ntxt', 'last' and 'redo' controls cannot be used to exit the block.

Regards!

...JRF...
anilsingh
Occasional Contributor

Re: Perl Script help for infinite loopand exit for user i/p mismatch

Thanks a lot James.After looking into the code snap providerd by you,I can really understand that usage of mainframe and not using PERL for long time really blunted my PERL skill ;-)