ruben has asked for the wisdom of the Perl Monks concerning the following question:
thanx in advance, rubenuse strict my($num2,$num1,$binary,$j ); print "enter the number\n"; $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; }
Update: lc $title. larsen
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dec2bin for more than 32 bits
by particle (Vicar) on May 16, 2002 at 11:38 UTC | |
|
Re: dec2bin for more than 32 bits
by jsprat (Curate) on May 16, 2002 at 17:19 UTC | |
|
Re: Problem with integer to decimal conversion
by talexb (Chancellor) on May 16, 2002 at 13:19 UTC | |
by Sidhekin (Priest) on May 16, 2002 at 14:38 UTC | |
|
Re: Problem with integer to decimal conversion
by ruben (Novice) on May 17, 2002 at 04:58 UTC | |
|
Re: Problem with integer to decimal conversion
by dvergin (Monsignor) on May 19, 2002 at 14:42 UTC |