Bootstrap FreeKB - Perl (Scripting) - Upper case (uc)
Perl (Scripting) - Upper case (uc)

Updated:   |  Perl (Scripting) articles

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

my $foo = "Hello World";

 

The uc (upper case) operator can be used to update the value to be "HELLO WORLD".

$foo = uc($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 6f62ee in the box below so that we can be sure you are a human.