http://qs1969.pair.com?node_id=223443


in reply to making first letter of all words in array upper case

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:

foreach my $word (@words) { $word = ucfirst $word }

*--assuming you're in list context, which in this case you are

        $perlmonks{seattlejohn} = 'John Clyman';