http://www.perlmonks.org?node_id=54125


in reply to Re: decimal to binary
in thread decimal to binary

I'm working on it and I have found shortest way to do that
sub to_bin { my( $num , $len ) = ( shift , 0 ); while( $num >> $len ){ $len++ ;} return reverse map {( $num & 1 << $_ ) ? "1" : "0";}(0..$len-1); }
did someone can do better ? ( I'm sure you can, I trust in you ;)