unlinker has asked for the wisdom of the Perl Monks concerning the following question:
I am a bit confused about how an unpack template works. For example:
#!/usr/bin/env perl use Modern::Perl; use Data::UUID; my $ug = Data::UUID->new; my $uuid = $ug->create_bin(); say unpack('H*', $uuid); # 767adecd8ed2e11191f4b1907aa0b7e4 my ($uu1, $uu2) = unpack('C4 C*', $uuid); say unpack('H*', $uu1); # Got 313138 Expected:767adecd say unpack('H*', $uu2); # Got 313232 Expected:8ed2e11191f4b1907aa0b7e4
I expected that 'C4 C*' would extract the first four bytes into $uu1 and C* would extract the rest into $uu2. Obviously I am not getting something here. Would appreciate an explanation
Thank you
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How do unpack templates work
by BrowserUk (Patriarch) on Jul 20, 2012 at 18:47 UTC | |
by unlinker (Monk) on Jul 20, 2012 at 19:06 UTC | |
by BrowserUk (Patriarch) on Jul 20, 2012 at 19:44 UTC | |
by unlinker (Monk) on Jul 20, 2012 at 20:12 UTC | |
by BrowserUk (Patriarch) on Jul 20, 2012 at 20:35 UTC | |
| |
Re: How do unpack templates work
by daxim (Curate) on Jul 20, 2012 at 17:39 UTC | |
by unlinker (Monk) on Jul 20, 2012 at 17:48 UTC | |
by jwkrahn (Abbot) on Jul 20, 2012 at 22:51 UTC | |
Re: How do unpack templates work
by flexvault (Monsignor) on Jul 21, 2012 at 07:16 UTC |
Back to
Seekers of Perl Wisdom