in reply to Reading and unpacking on one line
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11123425 use warnings; open FILNAM, '<', \<<END or die $!; 1234567890 abcdefghijkl END my $val = unpack 'H32', do { local $/ = \16; <FILNAM> }; print "$val\n";
UPDATED: changed input to an in memory file to make program completely self contained.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reading and unpacking on one line
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 |