Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: lcfirst and ucfirst not working

by davido (Archbishop)
on Aug 27, 2012 at 17:38 UTC ( #990030=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-10-01 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (38 votes), past polls