Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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?
marto quacks
[1nickt]: LanX You flatter yourself. I downvote only posts that I believe do not support and promote Perl. These would include threads berating P5P volunteers and others.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2018-04-26 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?