K
klaus_gb
I have the following Perl script 'test.pl':
use strict;
use warnings;
while (<>) { print $_; }
print "Message = '$!'\n";
when i run this script with a redirected input-file, it prints the
following:
C:\>test.pl <data.txt
Message = 'Bad file descriptor'
Does anybody have an idea why ?
if I run the script without any redirection, everything works as
expected, i.e. it reads from STDIN and echos on STDOUT, for example:
C:\>test.pl
ABC
ABC
DEF
DEF
^Z
Message = ''
I am using...
C:\>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 635 provided by ActiveState Corp.
http://www.ActiveState.com
Built 15:34:21 Feb 4 2003
....under Windows XP:
C:\>ver
Microsoft Windows XP [Version 5.1.2600]
use strict;
use warnings;
while (<>) { print $_; }
print "Message = '$!'\n";
when i run this script with a redirected input-file, it prints the
following:
C:\>test.pl <data.txt
Message = 'Bad file descriptor'
Does anybody have an idea why ?
if I run the script without any redirection, everything works as
expected, i.e. it reads from STDIN and echos on STDOUT, for example:
C:\>test.pl
ABC
ABC
DEF
DEF
^Z
Message = ''
I am using...
C:\>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 635 provided by ActiveState Corp.
http://www.ActiveState.com
Built 15:34:21 Feb 4 2003
....under Windows XP:
C:\>ver
Microsoft Windows XP [Version 5.1.2600]