- Jun
- 30
- 0
I want to execute a "dir /bf" command from within Perl. As the "f" option is a TCC option I need to invoke TCC.EXE instead of CMD.EXE. To do this I create the environment variable:
PERL5SHELL=C:\Program Files\JPSoft\TCMD12x64\tcc.exe
and then run the program:
#!perl -w
use strict;
use 5.12.0;
say $ENV{PERL5SHELL};
my @lns=`dir /bf `;
die $! if ($!);
chomp @lns;
say $_ foreach @lns;
When I do this I get the output:
C:\Program Files\JPSoft\TCMD12x64\tcc.exe
Bad file descriptor at C:\TestPad\debgtest.pl line 7.
If I do not create the PERL5SHELL then cmd.exe is invoked and the command work as expected (After I change the command to `dir /b` ).
Am I doing anything obviously wrong here or is TCC simply different from cmd.exe in a way that perl can not capture the command output stream as expected?
I am running
TCC 12.01.44 x64 Windows 7 [Version 6.1.7600]
and ActiveState Perl 5.12.2
PERL5SHELL=C:\Program Files\JPSoft\TCMD12x64\tcc.exe
and then run the program:
#!perl -w
use strict;
use 5.12.0;
say $ENV{PERL5SHELL};
my @lns=`dir /bf `;
die $! if ($!);
chomp @lns;
say $_ foreach @lns;
When I do this I get the output:
C:\Program Files\JPSoft\TCMD12x64\tcc.exe
Bad file descriptor at C:\TestPad\debgtest.pl line 7.
If I do not create the PERL5SHELL then cmd.exe is invoked and the command work as expected (After I change the command to `dir /b` ).
Am I doing anything obviously wrong here or is TCC simply different from cmd.exe in a way that perl can not capture the command output stream as expected?
I am running
TCC 12.01.44 x64 Windows 7 [Version 6.1.7600]
and ActiveState Perl 5.12.2