in reply to Pulling bytes out of string
It's unclear to me if mike65535 wants to unpack the example string given in the OP as pairs of characters to yield an array
('86', '02', '35', '39', ...)
or, interpreting each character pair as a hex byte, to produce
(0x86, 0x02, 0x35, 0x39, ...)
or maybe something else. Can the OPer please clarify?
Update: Oh, what the heck... Here's an example of the latter to go with the example of the former given above:
Of course, the dump is in decimal, so 0x86 == 134, etc. See Data::Dumper.c:\@Work\Perl\monks>perl -wMstrict -MData::Dumper -le "my $string = '8602353907455755'; my @arr = unpack 'C*', pack 'H*', $string; print Dumper \@arr; " $VAR1 = [ 134, 2, 53, 57, 7, 69, 87, 85 ];
Give a man a fish: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Pulling bytes out of string
by mike65535 (Novice) on Oct 22, 2015 at 12:43 UTC |