dreman has asked for the wisdom of the Perl Monks concerning the following question:

would someone please explain how to use an environment file that would have information in it like username and password, etc... like in ksh,sh scripts.. I'm not understanding the documentation or I haven't found the right source yet. Thanks

Replies are listed 'Best First'.
(jeffa) Re: need understanding
by jeffa (Bishop) on Nov 30, 2001 at 22:27 UTC
    I may be way off target - but if you are coming to Perl from a shell scripting language, you will be happy to know that environment variables are conveniently available from the %ENV hash. Try this out:
    while (my($key,$val) = each %ENV) { print "$key => $val\n"; }
    If this is not what you need, then please be more specific.

    UPDATE:
    The 'HOME' key contains the path to a user's home dir, the 'USERNAME' contains the user's username, but you can't get their password from the EVIRONMENT - that would be BAD BAD BAD! Think about it.

    UPDATE2:
    If you are looking for a configuration file like perrin suggested below, check out How to assign a variable with a value read from a config file.

    jeffa

    "You can pick your friends and you can pick your nose, but you can't pick your friend's nose."

      Sorry for the lack of information, but what I'm looking for is to pull set variables in my perl script. Like in KSH . .environment_file to prevent hard coding paths and passwords. Hope this gives more. Thanks.
        It sounds like you want a configuration file. There are tons of ways to do that in perl. Try searching for configuration or config, or check out some of the stuff on CPAN, like AppConfig.
        You could login to the account with that initialization file then start your perl script and get with %ENV as shown above. I don't know if there's a generic shell-initialization-file parsing CPAN module. Or if it's like .bashrc, maybe look on equals signs like /PATH=['"]?(\w+)/, though that's not a good solution in my opinion.