in reply to Obtaining the output of a system call, not the return status

Backticks or qx will do that:

my $html = qx(echo $plaintext | txt2html --extract);

Update: (remove foot from mouth) ++japhy is correct. In detail: echo would be ok (it's a shell builtin), but $plaintext = quotemeta $plaintext; needs to be said first. The absolute path to txt2html should be used. If $plaintext comes from a file, input redirection to txt2html would be better than reading it first and echoing.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Obtaining the output of a system call, not the return status
by japhy (Canon) on Feb 09, 2002 at 22:03 UTC
    Super unsafe. Not to mention, I'd think it's hard to extract HTML from a single line of text -- meaning, $plaintext is probably several lines long. It would need to be escaped and whatnot.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;