Problems? Is your data what you think it is? PerlMonks

### Re^2: Understanding Unpack on Decimal Value

by arblargan (Acolyte)
 on Nov 01, 2018 at 21:27 UTC Need Help??

in reply to Re: Understanding Unpack on Decimal Value
in thread Understanding Unpack on Decimal Value

ASCII!! That didn't even occur to me as this portion of the function is entirely numeric. I suspect that the way this was implemented in the original script was incorrectly understood. Thank you for the clarification. One additional question, if I could...

Since it returns only a portion of the result, I attempted to modify the snippet a little bit, but it still produced the same result. See below.

```my \$input = 0x916CD; #595661
my @unpacked = unpack "VV", \$input;
print(join ", ", @unpacked);
>>909457717 #0x36353935

```Dec: 825_636_405, 14_645
Hex: 0x31363635, 0x3935

Could you help me understand why this doesn't unpack into the array like I thought it would? Thanks for the help!

Replies are listed 'Best First'.
Re^3: Understanding Unpack on Decimal Value
by choroba (Cardinal) on Nov 01, 2018 at 21:51 UTC
You need a number greater than 9_999_999 to get more than one element back:
```for my \$input (9_999_990 .. 10_000_010) {
my @unpacked = unpack 'VV', \$input;
say scalar @unpacked, " \$input";
}
```(\$q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+\$1,++print+eval\$q,q,a,

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1225076]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-15 22:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found