The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Perl Subroutine
SteveD
post Feb 4 2007, 06:10 PM
Post #1


Newbie
*

Group: Members
Posts: 18
Joined: 16-November 06
From: Iowa
Member No.: 936



I have used subroutines in Perl before, inside the same file, but I would like to create a subroutine, or a set of subroutines, stored in their own file, then called from other files.

My guess is that in the calling program I would do a - use MODULE (name); at the top, then call the subroutine as I always have.

In the file of subroutines each subroutine would be defined as I have always done in the past.

Am I close?

Thanks,
Steve
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Effovex
post Feb 5 2007, 10:41 AM
Post #2


Serious Coder
*****

Group: Members
Posts: 251
Joined: 6-January 07
From: Sherbrooke, Qc, Canada
Member No.: 1,477



I'm not very familiar with Perl, but the synopsis for subroutines in the perl documentation says that to import a subroutine, you have to go
QUOTE
use MODULE qw(NAME1 NAME2 NAME3);


Which points to you being right.

This post has been edited by Effovex: Feb 5 2007, 10:41 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th April 2024 - 09:02 AM