diotalevi has asked for the wisdom of the Perl Monks concerning the following question:

Is there a common module that already has the first_defined(LIST) function implemented? I could just stick my own function into an application local util:: namespace but I'd rather just use someone else's code and not have to deal with it. Like List::Common::Something or whatever that module is named. I don't recall.

# Sample implementation # This function returns the first defined() element of its argument li +st. sub fdef { defined() && return $_ for @_ }

Replies are listed 'Best First'.
Re: Where is first_defined(LIST) canonically implemented?
by diotalevi (Canon) on Jun 15, 2003 at 13:21 UTC

    merlyn reminded me that it is spelled List::Util and first { defined() }. That's core in 5.8.0 so that answers my question.