On Aug 20, [EMAIL PROTECTED] said:
>I am confused about how perl provides for separate perl scripts to talk to
>each other. In k-shell I can load a function using . <file_name.ksh>. In
>the file I have defined a function
> function myfunction
> {
>
>I can execute that function from within any k-shell file by simply
> myfunction
If you define the function in a different file, first you must include
that file via
require "name/of/file";
Then, use the functions defined there.
There are MANY ways to call functions in Perl.
foo calls foo with no arguments (if foo has been predeclared)
foo ... calls foo with some arguments (if foo has been predeclared)
foo() calls foo with no arguments
foo(...) calls foo with some arguments
&foo calls foo with the same argument list as @_ holds
&foo() calls foo with no arguments
&foo(...) calls foo with some arguments
If you use an ampersand (&foo), then you are ensured that a user-defined
function (known as a subroutine) will be called. Example:
sub print { printf "%10s", shift }
print "hi\n"; # "hi\n"
&print("hi\n"); # " hi\n"
For more about require(), read perldoc -f require. For more about
functions, (re)read perldoc perlsub.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]