in reply to Re: Looking Through Arrays?
in thread Looking Through Arrays?

I worry about posts in this vein ( not to pick on fever, there have been many, by various monks, including myself ), where a question that is clearly from a beginner elicits a dense piece of minimal code. In this case we get grep, qw, implicit assignment to $_ and the ternary operator, all in three lines.

I'm not against offering challenging answers to help petitioners learn, but challenging should not mean off-putting, right?

To be fair, perhaps my perception of the petitioner's level is not the same as fever's.

Replies are listed 'Best First'.
Re: Re: Re: Looking Through Arrays?
by tachyon (Chancellor) on Dec 18, 2002 at 03:30 UTC

    I agree, far too much code - 3 lines where one will do

    sub check { grep{/^\Q$_[0]\E$/}qw/Recruit General Captain Civilian Airman/ ? W +elcome() : NotWelcome(); }

    or perhaps that was not what you meant... ;-)

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Re: Re: Looking Through Arrays?
by djantzen (Priest) on Dec 18, 2002 at 03:13 UTC

    Heh, I've never been called a programming showoff before, thanks! But look, he'd already received two helpful answers that were sufficient to set him on the right track. True, my answer is not appropriate for a newbie, but there is plenty of precedent for other monks discussing particular problems at higher levels of difficulty once the petitioner has been assisted.