CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Simple question...

 



steve
Deleted

Mar 30, 2000, 4:30 AM

Post #1 of 2 (937 views)
Simple question... Can't Post

Hello,

What is the difference between calling a sub routine with the "&" and without?

What is the difference between this:
$variable = &name_sub_routine()

and this:
$variable = name_sub_routine()

Thanks,
Steve


japhy
Enthusiast

Mar 30, 2000, 5:00 AM

Post #2 of 2 (937 views)
Re: Simple question... [In reply to] Can't Post

The 'perlsub' documentation does a better job of explaining this, but I will paraphrase.

1. function() -- if function() has prototypes, they will be honored

2. &function() -- prototypes are NOT honored

3. &function -- the same as saying &function(@_)

In most cases, you really don't need the & sign -- it's from Perl 4 code, most likely.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives