It's all about context. reverse by default works on a list in this case is in list context. Since there's only one list item ("dog"), it's printed out. In the second example, ucfirst forces the reverse into scalar context and in scalar context, reverse, combines all the elements of the list and returns the string value of that combination in reverse order.
Update: Doh!! adrianh is correct.
In reply to Re: reverse of string
by derby
in thread reverse of string
by msk_0984
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |