Вы можете сделать что-то вроде:
perl -le '
while (q(
c char, C unsigned char, s! short, S! unsigned short,
i! int, I! unsigned int, l! long, L! unsigned long,
f float, d double,) =~ /(\S+) (.*?),/gs) {
$size = length(pack $1, 0);
sysread STDIN, $data, $size;
print "$2($size): " . unpack($1, $data);
}' < /dev/urandom
Что в 64-битной системе даст вам что-то вроде:
char(1): -98
unsigned char(1): 62
short(2): -12526
unsigned short(2): 399
int(4): 499066219
unsigned int(4): 2312134917
long(8): -4889591208978026255
unsigned long(8): 2080566823379835456
float(4): 55.4727554321289
double(8): 8.6395690272822e-05