use strict; use warnings; use ActiveState::Prompt qw/prompt/; my $answer = prompt('Please enter a, A, b, B', must_match => [qw/a A b B/], no_match_msg => 'a, A, b or B only please!', ); print $answer;