undef
Piers Harding
piers at ompa.net
Fri Nov 8 04:16:47 CST 2002
Both will do.
CHeers.
On Fri, Nov 08, 2002 at 10:51:51PM +1300, Richard Hector wrote:
> On Fri, 2002-11-08 at 22:46, Piers Harding wrote:
> >
> > On Fri, Nov 08, 2002 at 10:00:56PM +1300, Richard Hector wrote:
> > > How do I detect that a function call has returned undef?
> >
> > Wont this do the trick?
> >
> > if (! defined(some_func()){
> > ....
>
> Ah, yes, thanks. I was looking under undef; didn't think of defined :-)
>
> I guess I can just as happily do
>
> $result = some_func()
>
> if (! defined($result)){
> ....
>
> Or possibly even
>
> if (! defined($result = somefunc())){
> ...
>
> Or do perl assignments not have C-style side-effects?
>
> Richard
>
More information about the Wellington-pm
mailing list