Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to use the code below where when the user enters small "e",the program exits,I want to make sure even when the user enters uppercase "E",the program exits.I tried the below but doesnt seem to work.

my $input = <STDIN>; exit if $user_input eq "e|E<Enter>\n";

Replies are listed 'Best First'.
Re: User input taking capslock into account
by toolic (Bishop) on Mar 15, 2011 at 02:19 UTC
Re: User input taking capslock into account
by Eliya (Vicar) on Mar 15, 2011 at 02:17 UTC
    ... exit if lc $user_input eq "e\n";

    Alternatively:

    ... exit if uc $user_input eq "E\n";

    (see lc)