my %actions = ( option1 => \&process_option1, option2=>\&processoption2 ); my $option = param('option'); $action{$option}->() or default_action(); exit; #### my %file_hash = ( a=>'notiagro.html', d=>'notideportes.html' # and so on ); my $catfile = $file_hash{$cat} || 'default value';