in reply to Please explain the pack function
Maybe this will help?
$integer = pack( 'i', 171 );; #The [pack] template 'i' converts a inte +ger print length( $integer );; # to a 4-byte string 4 # The first byte is ascii value 171 print ord( substr( $integer, $_, 1 ) ) for 0 .. 3;; 171 0 0 0 print chr( 171 );; ## Which displays as '½'. (On windows console,code +pages 437 & 850). ½ print chr( 172 );; ## Which displays as '¼'. (On windows console, code + pages 437 & 850). ¼
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Please explain the pack function
by Anonymous Monk on Apr 19, 2007 at 18:44 UTC |