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?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2018-02-19 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (258 votes). Check out past polls.

    Notices?