- or download this
print "Please enter your name:\n";
chomp( $name = <> );
$x = ucfirst $name;
print $x;
- or download this
# The \u metacharacter acts only upon the first character.
# No need for substr.
$x = "\u$name";
- or download this
# Assuming Perl 5.14+
$x = $name =~ s/^(.)/\u$1/r;
- or download this
$x = $name;
$x =~ s/^(.)/\u$1/;