One way is to put it in your environment. If you're in a shell script, export (bourne-shell and derivitives) or setenv (C shell and derivitives) should help there. If it's a perl script calling another perl script, see the %ENV hash.
Another way, since this is DB2, is to discard the password and username altogether. Run it as a user who has the authority to do what you need, and no password is required. DB2 will use the OS authentication to confirm who you are. This is how I've generally done this - avoids all the hassles of dealing with passwords in plain-text perl code.