Results 1 to 6 of 6
1) I am using a variable of another scripts in my script, following is my code :-
#!/usr/bin/perl -w
use strict;
require "./test.cgi";
for my $reslt (@values) {
if ( ...
- 03-05-2008 #1Linux Newbie
- Join Date
- Jan 2008
- Posts
- 114
how to use a variable in multiple perl scripts
1) I am using a variable of another scripts in my script, following is my code :-
#!/usr/bin/perl -w
use strict;
require "./test.cgi";
for my $reslt (@values) {
if ( $rslt eq "red" ) { next; }
print "Value find";
&test_fucn;
}
@values is from another script
but I am getting following error with use sctrict
Global symbol "@values" requires explicit package name at
compilation errors.
else
Name "main::values" used only once: possible typo at
syntax OK
Any other better way ???Switched to Scripting
- 03-05-2008 #2
Try putting this near the top:
... and, just to be safe, try putting the same statement near the top of the file you're requiring.Code:our @values;
--
Bill
Old age and treachery will overcome youth and skill.
- 03-05-2008 #3Linux Newbie
- Join Date
- Jan 2008
- Posts
- 114
I have another query
I want to call a function/subroutibe test_fucn from test.cgi for that I am doing following
#!/usr/bin/perl -w
use strict;
require "./test.cgi";
for my $reslt (@values) {
if ( $rslt eq "red" ) { next; }
print "Value find";
&test_fucn;
}
But problem - It is giving me whole printable output from test.cgi which is not a part of test_fucn.
any suggestions, so that I can use only subroutine ?Switched to Scripting
- 03-05-2008 #4
Whoa, whoa, WHOA! Did my suggestion work for you?
--
Bill
Old age and treachery will overcome youth and skill.
- 03-05-2008 #5Linux Newbie
- Join Date
- Jan 2008
- Posts
- 114
Ya now I am not getting those errors msg?
Thanks
Now I am looking for some other issue
I think require can not work in that case do u have any other suggestions?Switched to Scripting
- 03-05-2008 #6
You should go to that other thread. But you probably know that already. This is like letters getting crossed in the mail. :)
--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote