To convert a string to uppercase in Perl, you can use the uc()
function.
In this example,
"Hello World"
to the variable \$str1
.uc()
function to \$str1
to convert it to uppercase.\$str1
.\$str1 = "Hello World";
\$upper_case_str1 = uc(\$str1);
print "Uppercase of given string is: \$upper_case_str1\n";
Uppercase of given string is: HELLO WORLD
In this example,
"apple"
to the variable \$str2
.uc()
function to \$str2
to convert it to uppercase.\$str2
.\$str2 = "apple";
\$upper_case_str2 = uc(\$str2);
print "Uppercase of given string is: \$upper_case_str2\n";
Uppercase of given string is: APPLE
In this tutorial, we learned How to convert String to Uppercase in Perl language with well detailed examples.