Something I've always liked about Perl is its ability to return multiple values from a function. It doesn't come up that often, but whenever I'm writing a Java app at work and find myself resorting to something clunky like returning a List or array and reading out its values into useful variables, or resorting to a parameterized Pair class for more type safety, I always wish I had something more elegant like:
String, Int doSomething()
{
return "a string", 4
}
foo, bar := doSomething
Thoughts?
andyTue 20 Jul 2010
Theres been a few threads on this before - one of them here: #399
rfeldman Tue 20 Jul 2010
Something I've always liked about Perl is its ability to return multiple values from a function. It doesn't come up that often, but whenever I'm writing a Java app at work and find myself resorting to something clunky like returning a List or array and reading out its values into useful variables, or resorting to a parameterized Pair class for more type safety, I always wish I had something more elegant like:
Thoughts?
andy Tue 20 Jul 2010
Theres been a few threads on this before - one of them here: #399