in reply to Perl array into MySQL Database
One technical nit-pick comment on your code - the sub "DB_OPEN" doesn't explicitly *return* a value. Instead it depends on Perl's concept of returning the result of the last statement executed in the subroutine. Just my preference, but to me the code is cleaner if you explicitly return what is expected from the subroutine:
HTH.sub DB_OPEN { my ($db_name,$host_name,$port,$db_user,$db_pass,) = @_; my $database = "DBI:mysql:$db_name:$host_name:$port"; $dbh = DBI->connect($database,$db_user,$db_pass); return $dbh; # <----------------- :-) } # end-sub
|
|---|