Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Re: Re: Returning Values from Subroutines

by blokhead (Monsignor)
on Sep 06, 2002 at 17:33 UTC ( #195716=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Returning Values from Subroutines
in thread Returning Values from Subroutines

The return keyword can be omitted when it's the last line of a sub, so this will also work:
#!/usr/local/bin/perl print add(1,2); sub add{ $_[0]+$_[1]; }
or for that matter
sub add{ shift+shift; }
Update: OK, so I guess the shift() there is ambiguous. Anyway, you get the point.

blokhead

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://195716]
help
Chatterbox?
[Discipulus]: uh uh.. scent of gods..

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2018-06-22 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (122 votes). Check out past polls.

    Notices?