in reply to $io->autoflush - which perl version?

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") ...