If you describe your overall
goal ... your particular use-case ... more-completely at a place like this, you will get a better answer. Always remember that the CPAN search site
is literally stuffed
with solutions that you can simply take off-the-shelf and use
in your projects – and some Monk somewhere already knows all about the good ones. If you are doing "a thing that has already been done," such as in this case, you can be certain
that CPAN will be able to take you very far along your path, very fast. Therefore, always
begin there ... and, by asking conceptual questions here.