in reply to Re: defined() might be a good idea
in thread Check on if statement

I havent read the rest of the thread, I only comment because of your mistake in the cb ;-), but the test you describe:
if ( defined($foo) and $foo eq '?' ) { print "\$foo OK!\n"; }
Would be better (Lazier) written
print "\$foo OK!\n" if $foo and $foo eq '?';
in my opinion anyway...

Note that since $foo must be a '?', then it cant be _any_ false value, defined being only one of three. Thus you can dispose of the defined test and replace it with simple true or false.

Yves / DeMerphq
---
Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)