in reply to Problem with integer to decimal conversion

Sorry for the errors in the code.I am new to this.This is the corrected code
use strict; my($num2,$num1, $binary,$j ); print "enter the number\n"; $j=<>; $num2=rand 2**$j; $num1=int $num2; $binary = dec2bin($num1); print "binary=$binary\n"; sub dec2bin { my $str =join '', unpack "B32", pack "N", shift; $str=substr($str,-$j); return $str; }
regards,
ruben