David wrote:

   >    defined $thing and return $thing

Why not use the existing mechanism? Namely:

        return $_ for grep{defined} $thing;

which also scales rather nicely:

        return $_ for grep{defined} $thing, $otherthing, $somethingelse;


As for the original problem of:

        1 until defined(getvalue()); return it;

You can already write:

        1 until defined($_=getvalue()); return $_;

which doesn't seem a huge extra burden.


Or, if you worry about $_ pollution, use this:

        {return $_ for grep{defined or redo} getval()}

Damian

Reply via email to