D
Degz
Hi,
I'm just learning how to use perl with CGI, and have come up against a
problem whereby I can't seem to get multiple lines back to my web page.
My prog looks like this
#!/usr/bin/perl -wT
use strict;
use CGI;
my $cgi_mod = new CGI;
# Find Command And Execute It.
#my $command = $cgi_mod->param( 'COMMAND' );
my $command = "ls -l";
my @ret_vals = `$command`;
print $cgi_mod->header( "text/html" ),
$cgi_mod->start_html( -title => "These Are The Arguments I
Received.",
-bgcolor => "#ffffff",
-style => "text/css",
-color => "black");
print $cgi_mod->h1("Please See Below Output Of The Command You
Typed."),
$cgi_mod->hr;
foreach my $line_by_line (@ret_vals) {
print $cgi_mod->p("$line_by_line")
}
print $cgi_mod->end_html;
The problem is the print statement in the foreach loop only seems to
print the first line of my data. If however I run the perl script on
it's own I get all data returned ???
Any help is appreciated.
Cheers
Degz
I'm just learning how to use perl with CGI, and have come up against a
problem whereby I can't seem to get multiple lines back to my web page.
My prog looks like this
#!/usr/bin/perl -wT
use strict;
use CGI;
my $cgi_mod = new CGI;
# Find Command And Execute It.
#my $command = $cgi_mod->param( 'COMMAND' );
my $command = "ls -l";
my @ret_vals = `$command`;
print $cgi_mod->header( "text/html" ),
$cgi_mod->start_html( -title => "These Are The Arguments I
Received.",
-bgcolor => "#ffffff",
-style => "text/css",
-color => "black");
print $cgi_mod->h1("Please See Below Output Of The Command You
Typed."),
$cgi_mod->hr;
foreach my $line_by_line (@ret_vals) {
print $cgi_mod->p("$line_by_line")
}
print $cgi_mod->end_html;
The problem is the print statement in the foreach loop only seems to
print the first line of my data. If however I run the perl script on
it's own I get all data returned ???
Any help is appreciated.
Cheers
Degz