in reply to Return Question in Subroutine
This gives back the undef the caller gave you (but in the proper context). As pointed out in earlier comments, that may not be what you want. To me this is sensible. It takes this routine out of the equation, leaving the caller to repair its own undefs.sub cleanup { return unless defined $_[0]; # remainder of code with no if around it. }
I might also name the variable something. Some people would do something to make $_[0] into $_, so it doesn't have to appear on each line (but I'm not one of those people).
Phil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Return Question in Subroutine
by Anonymous Monk on Apr 28, 2006 at 13:59 UTC |