Bootstrap FreeKB - Perl (Scripting) - Lower case (lc)
Perl (Scripting) - Lower case (lc)

Updated:   |  Perl (Scripting) articles

In this example, the $foo variable contains "Hello World".

my $foo = "Hello World";

 

The lc (lower case) operator can be used to update the value to be "hello world".

$foo = lc($foo);

 

In a regular expression, the i operator can be used to ignore case in a comparison. In this example, the comparison operator checks if the $foo variable contains the text "hello", regarless of the case sensitivity of the value in the $foo variable.

if ($foo =~ /hello/i) {
  print "foo contains hello\n";
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d21c8c in the box below so that we can be sure you are a human.