Thanks Tim,

I'll give it a whirl.

Colin

-----Original Message-----
From: Timothy Johnson [mailto:tjohnson@;sandisk.com]
Sent: Wednesday, November 06, 2002 14:47
To: Johnstone, Colin; '[EMAIL PROTECTED]'
Subject: RE: Include files in PERL



I think 'use' is what you're looking for.  But just in case,

perldoc -f require
perldoc -f use
perldoc perlmod

On the last one, I would recommend reading the first section and then
skipping down to the "Perl Modules" section.  Then you can go back over the
whole thing.  Just to give you a taste of how modules work, here's a sample
...pm file.  Don't forget the 1 at the end.

#################################
#  Sample.pm

package Tim::Sample; #assumes the file is at .../site/lib/Tim/

sub InsertSpaces{
  my @text = split //,$_[0]; #get characters of function parameter
  return join(' ',@text);    #return string made of chars w/spaces between
}

1
#################################

#################################
#  Sample.pl

use strict;
use warnings;
use Tim::Sample;

my $text = Tim::Sample::InsertSpaces("Hello World!");
print $text;

#################################

This prints "H e l l o  W o r l d !".
-----Original Message-----
From: Johnstone, Colin [mailto:Colin.Johnstone@;det.nsw.edu.au]
Sent: Tuesday, November 05, 2002 7:17 PM
To: '[EMAIL PROTECTED]'
Subject: Include files in PERL


Gidday from downunder,

When writing PHP if I want to an include I type include("filename.php");

Is there a similar command in PERL, does require do the job? In my mailing
list application I re-use numerous functions and would like to pop these in
a function library and include them on every page.

Colin Johnstone 
Website Project Officer
NSW Department of Education and Training 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to