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
- Re: 1 until defined(getvalue()); return it; Simon Cozens
- Re: 1 until defined(getvalue()); return it; Michael G Schwern
- Re: 1 until defined(getvalue()); return it; John Porter
- Re: 1 until defined(getvalue()); return it; John Porter
- Re: 1 until defined(getvalue()); return it; David L. Nicol
- Re: 1 until defined(getvalue()); return it; David L. Nicol
- Re: 1 until defined(getvalue()); return it; Michael G Schwern
- Re: 1 until defined(getvalue()); return it; Michael G Schwern
- Re: 1 until defined(getvalue()); return it; Simon Cozens
- Re: 1 until defined(getvalue()); return it; John Porter
- Re: 1 until defined(getvalue()); return it; Damian Conway
- Re: 1 until defined(getvalue()); return it; David L. Nicol
- Re: 1 until defined(getvalue()); return it; Simon Cozens
- Re: 1 until defined(getvalue()); return it; Vijay Singh
- RE: 1 until defined(getvalue()); return it; David Grove
