in reply to Better way of matching

First, use the code tag. Now answering your question, you can use hashes for that (untested):
my %functions = ( net => sub { ... }; type => sub { ... }; ); my %input_values = (net => 1, type => 2); my %cmp_values = (net => 1, type => 3); my @keys = qw/net type/; foreach my $key (@keys) { my $curval = $input_values{$key}; if ($curval == $cmp_values{$key}) { &{$functions{$key}}($curval); } }

Igor 'izut' Sutton
your code, your rules.