I agree with
fever completely, but I would suggest using a plain
return; instead of
return undef; in those cases where you want to return an undefined value. The plain
return returns
undef when called in scalar context and an empty list when called in list context, which is very handy (for example, if you are calling the subroutine through
map and want the bits that don't return a value to be ignored altogether).