On Oct 8, Sara Gribble said:

>I would appreciate some help with this. I am learning
>Perl. I have a string inputed by the user. This string
>is then split, every first letter of each word in the
>string is uppercased, then joined back together and
>printed.

>my @words = split( / /, $firstline );
>print "$_\n" foreach ( @words );

What you need to do goes here.

There are many ways to make the first character of a string in an array of
strings uppercase.  Here is one way:

  foreach (@words) { $_ = ucfirst }

>$firstline = join( ' ', @words ); # joins the string
>print "$firstline\n";

Read 'perldoc -f ucfirst' for more details.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to