LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2005, 08:25 PM   #1
shifty_eyes
LQ Newbie
 
Registered: Sep 2005
Location: Victoria, B.C
Distribution: Slackware
Posts: 11

Rep: Reputation: 0
perl subroutine call


Hi, I'm just learning perl and I was wondering if anyone could help clear this up for me. Say we had something like this
Code:
sub something {
    ....
}
something;
&something;
Is there a difference between the last two statements?
 
Old 10-01-2005, 08:36 PM   #2
destuxor
Member
 
Registered: Oct 2005
Posts: 51

Rep: Reputation: 16
If you use the '&', the call is restricted to subroutines defined in the script you're running and cannot run built-in commands.

So:
Code:
#!/usr/bin/perl

sub print {
  printf("This is a local function\n");
}

print ("This is a built-in function\n");
&print ();
 
Old 10-01-2005, 08:43 PM   #3
shifty_eyes
LQ Newbie
 
Registered: Sep 2005
Location: Victoria, B.C
Distribution: Slackware
Posts: 11

Original Poster
Rep: Reputation: 0
Ah, gotcha. Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Call a C program from Perl CGI Script anoop_cn Programming 1 05-11-2004 04:37 PM
how to call c programm from perl scripts akaash Programming 4 03-18-2004 07:41 PM
Perl undefined subroutine /can't locate object method cobien Programming 1 11-17-2003 10:47 AM
Need Perl/CGI help! Undefined Subroutine CragStar Programming 4 03-05-2002 07:28 AM
Perl Subroutine problem sykkn Programming 0 02-20-2002 09:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration