From read:
> Returns the number of characters actually read, 0 at end of file, or undef if there was an error
Therefore, the second version is equivalent to
$val = unpack 'H32', 16;
because the read returned 16.
If you only specify the template, unpack uses the default variable $_ as the value to unpack.
You can use do to read and return the value you have just read:
$val = unpack 'H32', do { read FILNAM, $_, 16; $_ };
But you should check what read returned to handle possible errors.
Also, calling a file handle FILNAM, which rather seems to be an abbreviation of "file name", is misleading.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
|