System Functions Perl

$decimal = 4;
$binary = unpack("B32", pack("N", $decimal));
print $binary;