in reply to How to print the contents of system function to a .txt file

G'day astronogun,

While there's quite a few issues with the code you posted, I see nothing that would prevent appending to a text file:

$ ls -l input.txt ls: input.txt: No such file or directory $ perl -e '$input = q{input.txt}; @output = system ("ls -l >> input.tx +t");' $ ls -l input.txt -rw-r--r-- 1 ken staff 16393 12 Mar 15:34 input.txt

Here's some of the issues I found with your code:

I'd suggest something like the following code as a starting point from which you can inspect return values and investigate your problem further.

$ perl -e ' use strict; use warnings; use autodie qw{:all}; my $output_file = q{output.txt}; my $return_value = system "ls -l >> $output_file"; '

You'll note both here, and earlier, that I've used a simple ls -l command to test the code. I'd suggest you do the same, to check whatever file-appending problem you're experiencing, before trying with "java -jar cmdline-jmxclient-0.10.3.jar - localhost:1100 com.ogs.red5.client.manager:name=Manager getConnectedAgents" which may have its own issues that could be masking your reported problem.

-- Ken