in reply to Error 404 fix

Simple fix. You have an if check in your findurl subroutine. Don't set a global variable $url, but return it. Something like this:
sub findurl { my $url; open (INFO, $datafile) or die "Can't open $datafile: $!"; while (<INFO>) { my ($title, $location) = split(/\|/ , $_); if ($title eq $name) { $url = $location; } } close (INFO); return $url; }
That means you'll have to call it slightly differently:
my $url = findurl(); if (defined $url) { doit(); } else { incomplete(); }
I'd try to get rid of the global variables as far as possible, passing $name as an argument to findurl(), and $url as an argument to doit().

As for general coding advice, you ought to look into using the -w flag and strict. In CGI scripts, you should also use -T for taint checking (see perlsec), and there's usually no good reason not to use CGI instead of your parse subroutine. Yours doesn't handle checkboxes, for example.

Don't worry, these things will help you in the long run.

Replies are listed 'Best First'.
RE: Re: Error 404 fix
by koacamper (Acolyte) on Sep 30, 2000 at 22:35 UTC
    chromatic,
    Thank you for your answer to my question concerning my question. I am very new to perl and am trying to learn as quickly as possible. I've looked through the list of books and was wondering what book would you suggest for someone as "Green" as me?
    Thanks again,
    koa
    i want to learn