in reply to Text formatting a command in CGI
You are on the right track using multi-arg system for safety. If you want to get data back from the call, you can use a magic open call. It's safer than using backticks (see above).
Now you can do what you like with what's in $data -- replace newlines with <br>'s, print between <pre> tags, etc.open(my $fh, '-|', 'nmap', $ip); ## may not be supported in your version of Perl, so ## also consider the equivalent: ## open(my $fh, '-|') or exec 'nmap', $ip; my $data = do { local $/; <$fh> }; close $fh;
Update: BTW, the <pre> HTML tag makes the browser wrap according to your whitespace (instead of ignoring whitespace), as in my example code snippet. Search for it at your favorite HTML reference site and you will see what I mean.
Update II:Heh. Yeah, using text/plain will work too. But if you ever want to do anything with the data, get it from the program with the magic open call.
blokhead
|
|---|