#!/usr/bin/perl -w use strict; my %allowed_reply= ( yes => 1, no => 1, ); my $var = "yes"; if ( $allowed_reply{$var} ) { print "You choose $var\n"; }else{ print "you chose something other then yes or no\n" }