@@ -5702,14 +5702,14 @@ the I<length-item> is the string length, not the number of strings. With
5702
5702
an explicit repeat count for pack, the packed string is adjusted to that
5703
5703
length. For example:
5704
5704
5705
- This code: gives this result:
5705
+ This code: gives this result:
5706
5706
5707
- unpack("W/a", "\004Gurusamy") ("Guru")
5708
- unpack("a3/A A*", "007 Bond J ") (" Bond", "J")
5709
- unpack("a3 x2 /A A*", "007: Bond, J.") ("Bond, J", ".")
5707
+ unpack("W/a", "\004Gurusamy") ("Guru")
5708
+ unpack("a3/A A*", "007 Bond J ") (" Bond", "J")
5709
+ unpack("a3 x2 /A A*", "007: Bond, J.") ("Bond, J", ".")
5710
5710
5711
- pack("n/a* w/a","hello ,","world") "\000\006hello ,\005world"
5712
- pack("a/W2", ord("a") .. ord("z")) "2ab"
5711
+ pack("n/a* w/a", "hi ,", "world") "\000\003hi ,\005world"
5712
+ pack("a/W2", ord("a") .. ord("z")) "2ab"
5713
5713
5714
5714
The I<length-item> is not returned explicitly from
5715
5715
L<C<unpack>|/unpack TEMPLATE,EXPR>.
@@ -5729,10 +5729,10 @@ may be larger. This is mainly an issue on 64-bit platforms. You can
5729
5729
see whether using C<!> makes any difference this way:
5730
5730
5731
5731
printf "format s is %d, s! is %d\n",
5732
- length pack("s"), length pack("s!");
5732
+ length pack("s"), length pack("s!");
5733
5733
5734
5734
printf "format l is %d, l! is %d\n",
5735
- length pack("l"), length pack("l!");
5735
+ length pack("l"), length pack("l!");
5736
5736
5737
5737
5738
5738
C<i!> and C<I!> are also allowed, but only for completeness' sake:
@@ -5750,11 +5750,11 @@ the command line:
5750
5750
5751
5751
or programmatically via the L<C<Config>|Config> module:
5752
5752
5753
- use Config;
5754
- print $Config{shortsize}, "\n";
5755
- print $Config{intsize}, "\n";
5756
- print $Config{longsize}, "\n";
5757
- print $Config{longlongsize}, "\n";
5753
+ use Config;
5754
+ print $Config{shortsize}, "\n";
5755
+ print $Config{intsize}, "\n";
5756
+ print $Config{longsize}, "\n";
5757
+ print $Config{longlongsize}, "\n";
5758
5758
5759
5759
C<$Config{longlongsize}> is undefined on systems without
5760
5760
long long support.
@@ -5783,14 +5783,14 @@ Peace" by Danny Cohen, USC/ISI IEN 137, April 1, 1980.
5783
5783
5784
5784
Some systems may have even weirder byte orders such as
5785
5785
5786
- 0x56 0x78 0x12 0x34
5787
- 0x34 0x12 0x78 0x56
5786
+ 0x56 0x78 0x12 0x34
5787
+ 0x34 0x12 0x78 0x56
5788
5788
5789
5789
These are called mid-endian, middle-endian, mixed-endian, or just weird.
5790
5790
5791
5791
You can determine your system endianness with this incantation:
5792
5792
5793
- printf("%#02x ", $_) for unpack("W*", pack L=>0x12345678);
5793
+ printf("%#02x ", $_) for unpack("W*", pack L=>0x12345678);
5794
5794
5795
5795
The byteorder on the platform where Perl was built is also available
5796
5796
via L<Config>:
@@ -5947,9 +5947,9 @@ characters. For example, to L<C<pack>|/pack TEMPLATE,LIST> or
5947
5947
L<C<unpack>|/unpack TEMPLATE,EXPR> a C structure like
5948
5948
5949
5949
struct {
5950
- char c; /* one signed, 8-bit character */
5951
- double d;
5952
- char cc[2];
5950
+ char c; /* one signed, 8-bit character */
5951
+ double d;
5952
+ char cc[2];
5953
5953
}
5954
5954
5955
5955
one may need to use the template C<c x![d] d c[2]>. This assumes that
0 commit comments