Graham Barr <bodg@tiuk.ti.com> writes:
>I was just attempting to test some of my check some of my code with
>use strict;
>
>However my code contained the following statement
>
> select((select($fd), $| = 1)[$[]);
>
>use strict 'refs' causes this to crash with
>
>Can't use string ("main::STDOUT") as a symbol ref while "strict refs" in use at tst line 80.
>
>My question is, is this a bug or is there some other way to turn on
>autoflushing of a file handle ?
It seems that select always returns the name ot the currently selected
filehandle, eg
#!/usr/local/bin/perl
$fd = \*STDERR;
print $fd,"\n",select($fd),"\n",select($fd),"\n";
outputs:
GLOB(0x8e2cc)
main::STDOUT
main::STDERR
Is this really what we want ?
although as a work for use strict
use strict;
select( ( eval '\\*' .select($fd), $| = 1)[0]);
does not fail :-)
Regards,
Graham.
--
Graham Barr <bodg@tiuk.ti.com>
Texas Instruments Ltd.