in reply to First Script

Assuming you are using ActiveState Perl, you can use the prompt function from the ActiveState::Prompt module. It does all you want and more:
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;

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James