Takamoto has asked for the wisdom of the Perl Monks concerning the following question:
I want to capture the output of the following system() call into a variable:
use strict; use warnings; my $p2tExe = '/Desktop/p2t'; my $PathDocumentUnicode = "test.pdf"; my $converted_text= ""; eval { $converted_text = `/Desktop/p2t -nodiag -layout -enc UTF-8 $P +athDocumentUnicode -` }; print $converted_text;
p2t is the executable of the fantastic pdftotext (XpdfReader) suite. I read that system() doesn't return the output, just the exit status, and that I should use Backticks. However the following does not work (Can't exec "/Desktop/p2t": No such file or directory at pdftotext.pl line 9.):
eval { $converted_text = `$p2tExe, "-nodiag", "-layout", "-enc", "UT +F-8", "$PathDocumentUnicode", "-"` };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: use of Backticks to catch console output
by davies (Monsignor) on Dec 10, 2022 at 15:55 UTC | |
Re: use of Backticks to catch console output
by kcott (Archbishop) on Dec 10, 2022 at 21:49 UTC | |
by haukex (Archbishop) on Dec 11, 2022 at 10:26 UTC | |
by kcott (Archbishop) on Dec 11, 2022 at 14:11 UTC | |
by haukex (Archbishop) on Dec 11, 2022 at 14:24 UTC | |
by kcott (Archbishop) on Dec 11, 2022 at 15:40 UTC | |
| |
Re: use of Backticks to catch console output
by Takamoto (Monk) on Dec 10, 2022 at 15:53 UTC | |
by harangzsolt33 (Deacon) on Dec 10, 2022 at 17:42 UTC |