Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Return Question in Subroutine

by nimdokk (Vicar)
on Apr 28, 2006 at 13:00 UTC ( [id://546261]=note: print w/replies, xml ) Need Help??


in reply to Return Question in Subroutine

You probably don't need the "else" in there, simply return at the end. If your "if-statement" did anything, the return in that block would happen first and you would never get to the second return. If nothing happens, your code would simply skip down to the final return and go back to the main program. I don't think it hurts anything to have it in there, and might be useful in the future if you wanted the routine to do something different if $_[0] was undefined. You might want to ask whomever added it to find out their reasoning for putting the else in there.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://546261]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-18 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found