in reply to How to expand a string

In a particular chapter of Higher Order Perl, there is an implementation of this very problem. I don't have the book on me at the moment unfortunately, but it's in there.