#!/usr/bin/perl use strict; use warnings; sub bitstring {   return undef unless $_[0] =~ /^\d*$/;   my $bstr = unpack("B*", pack("L",$_[0]));   sprintf ( "%s%s%s%s", substr($bstr, 24, 8),                         substr($bstr, 16, 8),                         substr($bstr, 8, 8),                         substr($bstr, 0, 8)); } print "21098765432109876543210987654321\n"; print bitstring(3)."\n"; print bitstring(254)."\n"; print bitstring(255)."\n"; print bitstring(256)."\n"; print bitstring(65534)."\n"; print bitstring(65535)."\n"; print bitstring(65536)."\n";