M
Madhu Ramachandran
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
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