Ciba LO <> wrote:
> The following script fails to break the lines in listing the directory
> contents with long listing format --- see below.
> $out = exec("ls -l");
Where does the output from ls go?
It goes to STDOUT.
In a CGI environment STDOUT ends up at the browser.
There are no <br>s in the output from ls, so there are no <br>
tags for the browser to act on.
> print "$out<br>\n";
If the ls executes, then this print statement is _never_ reached!
(Because your perl process has been replaced by the ls process.
That's what the *and never returns* means in the first line
of the description for the exec function that you are using.
)
> Please help me to break the lines in printing to html lines!
foreach my $line ( `ls -l` ) {
print "$line<br>";
}
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas