I have defined variable in linux using command #year=twenty
Now i want to use CGI script to print this value.
how can i do so?
quick response will be highly appreciated.
unless ( open FIN, "variable.txt" ){
print "cannot read file: variable.txt\n";
return;
}
$line = <FIN>;
chomp $line;
close FIN;
( $junk, $value ) = split( /\=/, $line );
print "VALUE: $value \n";
Here can you help me with your parameters that you have used in context to my query?
well.... you have to store the variable you want in a file somewhere.
when you say "CGI", I'm assuming you mean through apache and perl.
So you write your "#year=value" in a file somewhere.
Make sure that "world" has read access to this file.
What I wrote goes into a script that apache accesses:
http://myserver.com/cgi-bin/quirks.pl
something like that....
No, i haven't defined variable in CGI script, i am using perl and executing script in Linux.
i want to print variable which i have defined at command line using CGI script.
oh...
$num = 0;
for $arg in ( @ARGV ){
$num++;
print "arg[$num]: $arg \n";
}
In an odd perl quirk, the command itself is: $0
Hi quirkasaurus, Thanks for your reply, but i haven't understood what you are trying to say here, if you will try to explain it to me with consideration of my variables it will help me since i am a beginner to unix & CGI scripting.
THanks in advance.