Update the first character in a string to be upper case in Perl (ucfirst)

Home > Search

In this example, the $foo variable contains "hello world".

my $foo = "hello world";


The ucfirst (upper case first) operator can be used to update the first character to be upper case. In this example, the value to be "Hello world".

$foo = ucfirst($foo);


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

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