http://qs321.pair.com?node_id=464298


in reply to Reopen file when contents changed?

You may simply want seek. I'm not really sure if it is well suited for that particular file, which may not be the case. It' worth trying in any case.

Incidentally under *NIX there's not strictly speaking anything like "text mode".

Update: I didn't want to test this myself, but in the end I did and it seems to work just fine:

#!/usr/bin/perl use strict; use warnings; open my $fh, '<', '/proc/stat' or die $!; { print scalar <$fh>; seek $fh, 0, 0; sleep 1; redo; } __END__