The sub doesn't return null (as in the traditional sense of null) but the bareword null. This function will cause the interpreter to barf if 'use strict' is in place. I would suggest either quoting null (bad idea from an idiomatic viewpoint) or change the function to just fall off (then you can check for definedness).
but to answer your question, you would need to do a string comparison:
my $ret = findTheTypeByTheName( "whatever" ); if( $ret eq "null" ) { print "Name not found in the code named below."; }
but I would suggest dumping the bareword nulls all together - they just feels creepy.
-derby
In reply to Re: using return types
by derby
in thread using return types
by Brother Sharky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |