Hi, I'm having trouble with a script that looks thru authorlist.txt and looks to see if $author equals any of the lines.
But, so far no matter what you type in for $author, it says that $author allready exists!
Here's the sorting part of the script:
And here is authorlist.txt
As you can see, there is not even the letter J in authorlist.txt, but if you enter J, it will say that author name allready exists!
Also, I would like it if it would match exact case, so if you enter the name "Moo" it does not say that it allready exists because "Moooo" allready does.
_______________________________________
You don't know me.
But, so far no matter what you type in for $author, it says that $author allready exists!
Here's the sorting part of the script:
Code:
my $author = param('author') or die "You have to enter a Nick Name.";
open(FILE, "<authorlist.txt") or die "Can't open authorlist.txt: $!";
seek(FILE,0,0);
@file = <FILE>;
chomp($key = $author);
foreach $el (@file)
{
if ($key == $_)
{
print "That username allready exist, click back and try a different one\n";
exit;
}
}
And here is authorlist.txt
Code:
Evan
Max T1
Pow~V1
HomeFry
Moooo
As you can see, there is not even the letter J in authorlist.txt, but if you enter J, it will say that author name allready exists!
Also, I would like it if it would match exact case, so if you enter the name "Moo" it does not say that it allready exists because "Moooo" allready does.
_______________________________________
You don't know me.