Bootstrap347
Programmer
- Sep 20, 2008
- 2
I'm new to Perl and already seeing how powerful this language is. I need help understanding the following unpack command:
Here's what I know:
- unpack is unpacking $table into the array data
- unpack is using the template ["","C*","n*","(H6)*",*N*"]->[$size] to do so
- C refers to unsigned char values
- n refers to unsigned shorts
- H6 refers to high nybble hex strings
- N refers to unsigned longs
- * somehow is a repeat count
also
- $size = 3
- the resulting @data array, after execution, is 9 elements in size
The use of "", brackets (usually for array elements) around the template items and then the use of ->[$size] has lost me...
Hope you can help.
Code:
@data = unpack(["","C*","n*","(H6)*",*N*"]->[$size], $table);
Here's what I know:
- unpack is unpacking $table into the array data
- unpack is using the template ["","C*","n*","(H6)*",*N*"]->[$size] to do so
- C refers to unsigned char values
- n refers to unsigned shorts
- H6 refers to high nybble hex strings
- N refers to unsigned longs
- * somehow is a repeat count
also
- $size = 3
- the resulting @data array, after execution, is 9 elements in size
The use of "", brackets (usually for array elements) around the template items and then the use of ->[$size] has lost me...
Hope you can help.