I ask that you present an actual coding problem. There are many ways to implement what you seek in Perl.
Perhaps present some pseudo code?
edit: I just don't know that problem that you are trying to solve?
Comment on Re: Modern exposition of "case" or Switch in perl 5.34?