Regarding your code:
This bit is silly:
#format site name for use with hashes $_ = $site; $_ =~ s/-//g; $_ =~ s/\.//g; my $username = $username{$_};
You don't need to get rid of characters like this to use hashes. You just need to put the hash key in quotes, if you are using it raw. E.g.
my %username = ( "site1.com" => "usernam1", "site2.com" => "usernam2", "site3.com" => "usernam3");
On a similar note, name => "$username" can just be name => $username. You don't need to force string context, Perl does that for you automatically. Ditto elsewhere in the script.
Personally, I also think that using CGI just to print HTML results in an ugly mix of HTML and perl; but that is my idiosyncratic view.
Other than that... hmm. "finish". On the whole, I suspect it is good to have a single "normal" exit point for a script - which would be in the main body, not a subroutine - and a separate "error" exit. Initially, these may do the same things. But sooner or later you may want to e.g. log an error to a file or whatever, and "finish" won't let you do that because it doesn't distinguish between good and bad exits. But that is just my opinion, again.
dave hj~
In reply to Re: Exiting improperly, or NN6 error?
by dash2
in thread Exiting improperly, or NN6 error?
by fireartist
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |