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

From your reply, I was expecting to have the following.

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,