#! /usr/bin/env perl my $word = pack 'I', 1; if ($word eq "\x01\x00\x00\x00") { print "little endian\n"; } else { print "big endian\n"; }