Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Task 1 is pretty easy thanks to the magic of map. Just @words = map {ucfirst $_} @words would do the trick.
Basically map takes a block and a list, and applies the code in the block to every element in the list (substituting each list element into $_). Then it returns the resulting list.* If you want to do it in an explicit foreach loop, as in your sample code above, you could write it this way:
*--assuming you're in list context, which in this case you are $perlmonks{seattlejohn} = 'John Clyman'; In reply to Re: making first letter of all words in array upper case
by seattlejohn
|
|