Click to See Complete Forum and Search --> : File handling


ssss
05-03-2005, 06:41 AM
I'm new to perl but i've managed to create a perl script that adds values from an html form to a text file, which works fine. The next step is to stop duplicate username's from being created. Is there a way of searching the text file before inserting?

This is how the script is set out:

print txt "-----------------------------------\n";
print txt "$FORM{'Forename'}\n";
print txt "$FORM{'Surname'}\n";
print txt "$FORM{'Email'}\n";
print txt "$FORM{'Login'}\n";
print txt "Password: $Password\n";

So the text file stores data like this:
-----------------------------------
forename
surname
forname.surname@domain.com
forname.surname
Password: 75563844

Jeff Mott
05-03-2005, 05:10 PM
Yes there is, but without knowing how that text file is formatted there isn't very much we can give you.

EDIT
- My bad. Apparently I can't read. I just noticed your example.

To be honest, you'd be far better off making a point of fully learning Perl before you continue any further. Figuring out the logic to solve a problem can be hard enough. When you don't know the tools at your disposal it becomes even worse, and usually results in poorly written code.

I'd recommend you check out the sticky on this board called "Learn Perl and CGI" and read through the entire ebook it points to.