Perl Monk, Perl Meditation | |
PerlMonks |
Re: $io->autoflush - which perl version?by Anonymous Monk |
on Mar 27, 2016 at 19:53 UTC ( [id://1158900]=note: print w/replies, xml ) | Need Help?? |
AFAIK for $io->autoflush(1); to work you just have to add use IO::Handle; at the top of your code; should work all the way back to at least 5.8. Perl 5.14 and up loads IO::Handle automatically, which is why the "autoflush" method "just works" there. The command "corelist IO::Handle" says "IO::Handle was first released with perl 5.00307". The other kind of kludgy but AFAIK backwards-compatible way to set autoflush on a handle is { my $tmp = select($io); $| = 1; select($tmp) }. And your "if" statement could be written like this: if($] lt "5.008") ...
In Section
Seekers of Perl Wisdom
|
|