in reply to reverse of string
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reverse of string
by adrianh (Chancellor) on May 20, 2006 at 16:46 UTC |