use strict;
use warnings;
$testCase = "testing";
my $test = "./$testCase.txt";
$command = "lin --help 2> $test";
my $result = `$command`;
print $result;
Note the use strict; and use warnings; directives. Those are your friend.
EDIT: I should probably mention that I used qx// rather than system() because the former will return a program's output, and the latter only returns the return status.
| [reply] [d/l] [select] |
#!/usr/bin/perl -T --
use strict;
use warnings;
my $testCase = 'testing';
my $command = 'lin --help';
my $test = sprintf "/usr/anil/scripts/ActData/%s.txt", $testCase;
open (STDERR, ">", $test )
or die "couldn't create $test : $!";
$t = system($command);
See perlopentut, perlsec, sprintf
| [reply] [d/l] |
I tried your script and testing.txt was created without problem.
So either /usr/anil/scripts/ActData doesn't exist (spelling?) or it is not writable by you. Or this code path is never executed (in a supposedly bigger script).
| [reply] |