in reply to get solution as short as possible
I can't endorse your desire "to shorten the 'foreach' block" nor support your "need (for) a nice-looking, laconic ... solution. Perhaps "nice-looking," shoudl have come out, since we may have very different ideas of the meaning of that phrase. Note that I did remove "as much Perl-ish as possible" from the quote.
I did so because the "Perl-ish" solution should heed the advice to keep the code readily comprehensible; the warning that the individual writing a script do so as if the (future) maintainer would be a homicidal maniac who knows the original author's home address.
Something of the same meme is enbedded in this portion of The path to mastery:
"When you see the code of master Perl programmers you may be amazed at how few strokes of the keyboard they require to solve a problem completely. Many in error think that they should therefore constantly try to cram as much into as little room as possible."This is a misguided path." (emphasis supplied)
So read on, especially (jcwren) RE: The path to mastery by jcwren and, tangentially, dragonchild's Re^3: The path to mastery.
Update: added sentence re "nice looking" in para 2.
|
|---|