At 12:17 -0500 2001.06.20, Ken Williams wrote:
>Howdy,
>
>Let me first issue the caveat that I have very little experience with bit
>manipulation, so this may be a dumb question.
>
>Consider the following one-liners:
>
> % perl -MConfig -le 'print $Config{byteorder}'
> 4321
> % perl -le 'print join(" ", map { sprintf "%#02x", $_ } \
> -> unpack("C*",pack("L",0x12345678)))'
> 0x12 0x34 0x56 0x78
>
>Those are the two methods `perldoc -f pack` suggests for finding out
>whether a machine is big-endian or little-endian. However, according to
>that page, the first output indicates big-endian, but the second output
>indicates little-endian.
>
>Anyone know why this is happening, and what the real answer is?
Well, I should add that $Config{byteorder} is pretty arbitrary, as it can
be changed after the build, and it really only affects N and V packs.
However, I should also add that on MacPerl, I get the same result as above.
I also know that Macs are big-endian. So my guess is that the output does
not indicate what someone thinks it indicates.
--
Chris Nandor [EMAIL PROTECTED] http://pudge.net/
Open Source Development Network [EMAIL PROTECTED] http://osdn.com/