if($input =~ m/y/i) { #do something } elsif($input =~ m/n/i) { #do something else } else { #do something different }