undef

Richard Hector rhector at actrix.gen.nz
Fri Nov 8 03:51:51 CST 2002


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