[Canberra-pm] Packing to big endian on old versions of perl

Jacinta Richardson jarich at perltraining.com.au
Fri May 1 05:01:23 PDT 2009


Paul Matthews wrote:
> On perl 5.10 the pack function allows you to say pack('n>',$num) to 
> encode a signed integer to big endian. And pack('n<',$num) to little 
> endian. However this feature is not available on older version of perl. 
> What is the most elegant means of achieving this?

What are you trying to achieve here?  Are you trying to convert data 
from one endian to another or do you specifically need to pack bits? 
Also how old is the version of Perl?  Are you supporting 5.5.3 (10 years 
old), or 5.6.0 (9 years old) or something else?  (Can you really not 
just upgrade?)

	J


More information about the Canberra-pm mailing list