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:
& operator in perl

 



klusener
Novice

Jan 29, 2008, 6:55 AM

Post #1 of 3 (347 views)
& operator in perl Can't Post

Hello All,

What does the following line of code mean

if ( &look_up( $var1 ) )

What i dont understand is the use of "&" keyword in the begining of the if test.

Thanks in advance.


KevinR
Veteran


Jan 29, 2008, 12:33 PM

Post #2 of 3 (345 views)
Re: [klusener] & operator in perl [In reply to] Can't Post

& in that context means "look_up" is a sub routine:

To call subroutines:

NAME(LIST); # & is optional with parentheses.
NAME LIST; # Parentheses optional if predeclared/imported.
&NAME(LIST); # Circumvent prototypes.
&NAME; # Makes current @_ visible to called subroutine.

Read this page for more details about how & affects your perl scripts behavior: http://perldoc.perl.org/perlsub.html
-------------------------------------------------


(This post was edited by KevinR on Jan 29, 2008, 12:34 PM)


klusener
Novice

Jan 29, 2008, 2:00 PM

Post #3 of 3 (343 views)
Re: [KevinR] & operator in perl [In reply to] Can't Post

Thanks i got the point :).

 
 


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

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