#!/usr/bin/perl use warnings; use strict; my @dispatch_tables = ( { regex => qr/\w+/, action => sub { print "aaa\n" }, }, { regex => qr/\d+/, action => \&hello_me, }, ); $dispatch_tables[0]->{action}->(); $dispatch_tables[1]->{action}->( "1", "2" ); sub hello_me { print "hello me: @_\n"; } __END__ aaa hello me: 1 2