1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl -w use strict; my $size = 100; binmode(STDOUT, ":utf8"); open(my $rf, '<', '/dev/random'); while ($size) { my $o; print STDERR "$size random bytes to read.\n"; read $rf, $o, 1; if ($o ne "\n" && $o ne "\r") { print unpack("H*", $o); $size--; } } close($rf);