- or download this
struct SupplyRequest {
time_t request_time; // time request was entered
...
short quantity; // quantity needed
short urgent; // request is urgent
};
- or download this
$rec = pack( "l i Z32 s2", time, $emp_id, $item, $quan, $urgent);
- or download this
Offset Contents (increasing addresses left to right)
0 160 44 19 62| 41 82 3 0| 98 111 120 101 115 32 1
+11 102
...
p a p e r c l i p s
32 0 0 0 0 0 0 0 0| 2 0| 1 0
00 00 00 00 00 00 00 00| 02 00| 01 00
- or download this
($order_time, $monk, $itemname, $quantity, $ignore) =
unpack( "l i Z32 s2", $rec );
- or download this
pack('a8',"hello") produces "hello\0\0\0"
pack('Z8',"hello") produces "hello\0\0\0"
...
unpack('Z8',"hello\0\0\0") produces "hello"
unpack('A8',"hello ") produces "hello"
unpack('A8',"hello\0\0\0") produces "hello"
- or download this
ord(pack('b8','00100110')) produces 100 (4 + 32 + 64)
ord(pack('B8','00100110')) produces 38 (32 + 4 + 2)
- or download this
pack('h4','1234') produces 0x21,0x43
pack('H4','1234') produces 0x12,0x34
- or download this
#!/usr/bin/perl -w
use strict;
...
DumpScalar($rec);
$rec = pack('H4',"1234"); # should produce 0x12,0x34
DumpScalar($rec);