use strict; use warnings; use diagnostics; my $count = 0; my $char; until (sysread STDIN, $char, 1) { $count++; } print $count;