Feb 18, 2002, 3:20 AM
Post #12 of 15
My intention also wasn't to write it in the shortest possible way. If I had been golfing, I think I would have posted something else. (As there's so many redundant whitespace in my code... )
My intention was to show that foreach and for can be interchanged. This is hard if you come from C (as I do) but if you're a "native" Perl speaker this is easy and saves you lots of typing. Another thing that I really like about Perl is that you can leave away parentheses in so many places and the fact that this can really improve readability. Again, this is a little hard for C programmers...
P.S.: Even shorter:
Assuming you have the invaluable Data::Dumper module already loaded.
At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."