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

how do i make $var="Bob"; match for "bob"? thanks, steve

Replies are listed 'Best First'.
Re: lower case
by Anonymous Monk on Feb 18, 2000 at 20:15 UTC
    simply: lc $var; To put it in the same var: $var = lc $var;
Re: lower case
by btrott (Parson) on Feb 18, 2000 at 22:57 UTC
    The fact that you said "match" sounds like you're talking about a regular expression... is that the case? If so, you can just say
    if ($var =~ /bob/i) { # Bob matches bob }
    Or, as the previous poster said, if you're just trying to compare two strings case-insensitively, use
    if (lc $var eq "bob") { # Bob matches bob }