calling subroutine
- From: "Madhu Ramachandran" <madhuram@xxxxxxxxxx>
- Date: Tue, 3 Jan 2006 18:35:10 -0500
hi,
iam new to perl. Iam getting an error in a subroutine invocation.
I have a main perl script say main.pl
I have a doThis.pl perl script in scripts subdir. So in main.pl i have the
following
#file: main.pl
#!/usr/local/bin/perl
unshift(@INC, "./scripts);
require("common.pl");
&common_sub(); # this is in common.pl file in scripts subdir
system("scripts/doThis.pl");
##### end of main.pl ####
#File: scripts/doThis.pl
#!/usr/local/bin/perl
print ("Hello there\n");
&mysub();
sub mysub()
{
print ("in mysub\n");
}
#### end of doThis.pl
I get error when i run
#perl main.pl
Undefined subroutine &main::mysub called at scripts/doThis.pl line 4,
<STDIN> line 1.
If i take out the unshift() and require in main.pl, and also take out the
call to common_sub, then
there is no error in call to mysub() in doThis.pl
would appreciate any help.
Thanks.
Madhu
.
- Follow-Ups:
- Re: calling subroutine
- From: Tad McClellan
- Re: calling subroutine
- From: Gunnar Hjalmarsson
- Re: calling subroutine
- Prev by Date: Re: Can't locate Filter/decrypt.pm
- Next by Date: Re: Convert potion of string to Octal
- Previous by thread: FAQ 4.69 How can I use a reference as a hash key?
- Next by thread: Re: calling subroutine
- Index(es):
Relevant Pages
|