Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In "man perlfunc," the unpack command has the heading:
unpack TEMPLATE,EXPRThe following code snippet works:
read FILNAM, $_, 16; $val = unpack 'H32';
But this does not:
$val = unpack 'H32', (read (FILNAM, $_, 16));
With the latter code, $val gets assigned 3136 (the hex string for 16). While I rank as a lowly novice, I still expected the one liner to work. Can someone explain (purely for my edification) why it doesn't?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading and unpacking on one line
by choroba (Cardinal) on Nov 05, 2020 at 16:19 UTC | |
|
Re: Reading and unpacking on one line
by tybalt89 (Monsignor) on Nov 05, 2020 at 16:31 UTC | |
by Anonymous Monk on Nov 05, 2020 at 22:18 UTC | |
by choroba (Cardinal) on Nov 05, 2020 at 22:33 UTC | |
by tybalt89 (Monsignor) on Nov 05, 2020 at 22:20 UTC | |
|
Re: Reading and unpacking on one line
by BillKSmith (Monsignor) on Nov 05, 2020 at 16:15 UTC |