loris,
You probably want to take a look at Implementing Dispatch Tables. The trouble with dispatch tables in Perl is that the conditions need to be exact keys. In other words, if you want any valueinteger in the range 1-999 to do the same thing, you need to create keys for each of those integers. There are ways around this in certain situations which is why I suggest reading that tutorial.