Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
"be consistent"
 
PerlMonks  

Re: Useless Program

by lhoward (Vicar)
on Jun 01, 2000 at 13:12 UTC ( [id://15802]=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 can make your scale better (to a file with a large number of names) by employing some sort of DB. In this case it also makes the code shorter. Here's your program using a tied hash to a SDBM file. All the modules you should need to do this are included with the perl install.
use Fcntl; use SDBM_File; my %db_names; tie (%db_names, 'SDBM_File', './names.db', O_RDWR | O_CREAT, 0666); print "Enter your name--> "; chomp (my $name = <STDIN>); if(defined $db_names{$name}){ print "Your name was already found\n"; }else{ print "Name not found. Would you like to add it? (y/n)--> "; chomp (my $yn = <STDIN>); if ($yn eq 'y') { $db_names{$name}=1; } } untie %db_names;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15802]
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.