in reply to Basic 'while' loop problem

The chomp advice above is correct, but for a different approach you could use Damian Conway's IO::Prompt module instead:
use IO::Prompt; my $query_prompt="$username would like to align your protein sequences + globally or locally? (enter either 'g' or 'l')"; my $error_prompt="$username, your selection was incomprehensible (ente +r either 'g' or 'l'):"; my $alignment_type = prompt ( -prompt => $query_prompt, -require => { $error_prompt => qr/^[gl]$ +/i }, );