Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
laziness, impatience, and hubris
 
PerlMonks  

RE: Useless Program

by cds (Sexton)
on Jun 01, 2000 at 05:55 UTC ( [id://15767]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Useless Program

You're problem would be that you only ever test the first line. If this is equal to the search term, then you say it was found. Otherwise, you're saying it wasn't, appending it, and exiting the loop.

Easiest solution would be have a loop that goes through checking each line. Have a flag that you set if you find the name (and exit the loop if you do). The after the loop check the flag. If it's set, you found the name and print the apropriate message. Otherwise you ask if they want to add it.

Colin Scott
If you build it, they will be dumb...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15767]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.