|Keep It Simple, Stupid|
wantarray alternativeby tqisjim (Beadle)
|on Jul 10, 2013 at 18:32 UTC||Need Help??|
tqisjim has asked for the
wisdom of the Perl Monks concerning the following question:
I've exhausted my imagination trying to reduce the lowercase function to a single line. But surely this problem has been solved by better minds than mine. Monks?
UPDATED I've posted several clarifications based on the replies so far. My original question is whether there's an equivalent function to first that is context sensitive.
tye's solution below, which uses a separate function named context, is elegant and concise and pretty close to what I'm looking for.
To restate my question one final time: What is the right way to get perl to do the right thing? I assumed there'd be an obvious answer. Although no consensus, I *did* get a lively conversation.