Parts of your problem_space is not quite clear to me, so this is largely a shot in the dark. Answers to the questions below will undoubtedly get you better answers.
Are you getting dbname, uname and p/w from something hardcoded in some other part of your script? ... from a form on a webpage? from the CLI?
Any why do want to obtain them within the sub? The reference to using a file sounds as though it might be rooted in a security concern, but that's merely a guess. An appropriate answer will also depend on whether your reference to "the server" is to a web server (Apache, etc) or to a fileserver or something else?
Despite that, taking a stab in the dark, one way to 'get these variables from a file somewhere else on the server" would be to add a block inside the sub (before line 6) opening (and be sure to test the open) the file, and reading the vars.
Why are you using use strict; in the sub. Does that mean you're not using strict (and warnings!) in main? If so, make your life easier by adding both in the head of your script.
In reply to Re: Database connection
by ww
in thread Database connection
by rooneyl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |