Actually - you need to use "require" instead of "use". (similar - but not
the same)
It's also important to place a
1;
at the end of the file containing your subs. (You'll get errors
otherwise..)
Here's an example:
----- begin sub_file.sub ------
#!/perl/bin
sub test {
$x = shift;
$y = shift;
print "$y $x\n";
}
1;
----- end sub_file.sub ------
----- begin test_remote_sub.pl -----
#!/perl/bin
require "sub_file.sub";
test("world", "hello");
----- end test_remote_sub.pl -----
Hope this helps,
Christian Lobaugh
[EMAIL PROTECTED]
> -----Original Message-----
> From: Sanjay Sharma [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 13, 2000 7:01 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: [perl-win32-gui] how to call a sub in another file
>
>
>
>
> Just say "USE" that file where you have written the function
> and you can
> call it,
> like
> use filename;
> filename::functionname(parameters)
>
> thanks
>
> -----Original Message-----
> From: General Solutions Co. [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 13, 2000 10:54 AM
> To: [EMAIL PROTECTED]
> Subject: [perl-win32-gui] how to call a sub in another file
>
>
> I am a C/C++ programmer and new to Perl. I created severl
> sub in one file.
> Can anyone tell me how to call these sub from another file?
> Because I am
> new,
> I don't want to make pm module which sounds complicated at
> this stage of my
> learning.
> Thank you
>
>
> ____________________________________________________________________
> Get Free Internet Access and WebEmail at
> http://www.address.com Click on
> this link http://www.address.com/giveaways/free.asp for great offers.
>