Read the data passed to a script on the command line?
<HTML>
<HEAD>
<TITLE>CGI How-to, ReadC_pl Test Form</TITLE>
</HEAD>
<BODY>
<A HREF="index.pl?test+query+string">Press here to try the test command line string.</A>
</BODY>
</HTML>
File: index.pl
#!/usr/local/bin/perl
sub readCommandLineData
{
local(*queryString) = @_ if @_;
$queryString = join(" ",@ARGV);
return 1;
}
print "Content-type: text/plain\n\n";
&readCommandLineData(*data);
print "The command line data is:\n\n";
print $data;
print "\n";
Related examples in the same category