in reply to
run shell command as another user
Wouldn't it be a lot easier (and safer, and more reliable, and more flexible, and more maintainable, andů) to use DBI, and have your perl script connect directly to the database(s) you want to get information from?
(There are database-driver modules on CPAN for connecting to DB2 databases, so it's just a question of making sure you have the modules you need, and then working out how to "list db directory" using DBI, rather than using shell commands that involve "su" privileges (*shudder*).
(Update: I realize you did mention something about not using modules, but there would have to be some severely compelling reason for not using DBI, especially if the alternative is that you have to use root privileges just to get information from databases.)