in reply to Need help to edit the script

Too much code. See How do I post a question effectively?
(Specifically, if you must post lots of code, please consider <readmore> and </readmore> tags.

At a glance, comments near top show what information is in the configuration, and hash %config (also near top of code) seems to contain that data.

The description in the comments seems to resonate with some of the words you have used to describe what you're looking for. So I am hopeful this would get you looking in the right direction.

If this isn't enough to get you moving, my only additional thought at the moment is that if you're not a Perl guy, perhaps you should work on becoming a Perl guy before you tangle with big Perl code.

Just a thought.