in reply to how to let sub return hash of 2 sub?

Here's one example of a sub returning a hash with two subs, each of which returns something. Without having more context, it's difficult to see exactly what you want long-term, but hopefully this'll give you an idea to get you started.

#!/usr/bin/perl use strict; use warnings; sub fetch_dispatch{ my $dispatch = { name => sub { return "name = this"; }, val => sub { return "val = that"; }, }; return $dispatch; } my $dt = fetch_dispatch(); print $dt->{name}(), ': ', $dt->{val}(), "\n";

-stevieb