Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: subroutine syntax

by marius (Hermit)
on Dec 11, 2000 at 03:37 UTC ( #45988=note: print w/ replies, xml ) Need Help??


in reply to Re: subroutine syntax
in thread subroutine syntax

For that matter, let's take a look at uses of the return function. (perldoc -f return)

my $xyz = 15; my $var = &example($xyz); print &example($xyz); sub example { my $tmp = shift || 0; my $tmp += 49; return $tmp }
Now, you can set the global $var to by equal to the return value of the subroutine. Also, you can just print the return of the subroutine if you like. return is a very handy tool when it comes to subroutine programming and cleaning up perl code.

-marius


Comment on Re: Re: subroutine syntax
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-09-17 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls