my $command = "echo $writeline >> $file"; my $output = `$command 2>&1`; #### my $output = `$command echo $writeline >> $file 2>&1`; #### my $output = `$command echo $writeline 2>&1 >> $file`;