Well, this is the first time I've actually seen someone freely admit that their question was a homework assignment/project, etc. I will give you a hint:
I work for a Tier-1 ISP, and have a little program that allows me to automate logging into any of our routers and issue commands. I use it to archive router configs, bgp tables, show diagbus, show ver, etc. It has two login levels; user & enable (privileged). This program needs a config file in the user's directory called .cisco_addresses.username, which contains either level 1 user/passwords or level 1 & level 2 user/passwords. I create these files for users as needed, and make sure that they are readable/writable only by the user. If the user needs to archive the output of commands, then he/she needs another config file, ie rquery_cisco.pl.show-run.user.
That said, I think that hard-coding ID/passswords is risky business. The only reason I need to do it the way I have described, is that we have literally hundreds of routers, most of which have unique user/password combinations. Additionally, only 2 people other than myself (aside from the neteng group) have access to level 2 login privileges.
I agree that in the future, you should phrase your questions using a bit more detail.