Greetings Sandro & all,

From the keyboard of Sandro CAZZANIGA [16.11.11,14:26]:

hi!

Just a little JAPH for convert decimal to binary.... Feel free to comment
it ;)

golfed down a bit, just for fun...

#!/usr/bin/perl -l
@ARGV or die "No args";
print"$_: ",($_=unpack"B*",pack"N",$_)=~s/0+//?$_:$_ for@ARGV;

----------------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
eval {@ARGV} or die("No args") ;
foreach my $arg(@ARGV) {
   my $convert = unpack("B*",pack("N", $arg));
   my @convertsp = split("", $convert);
   my $count = 0;
   foreach (@convertsp) {
       unless ($convertsp[$count] == 1) {
           $convertsp[$count] = "" ;
           $count++;
       }
   }
   print("$arg: @convertsp \n");
}
exit 0;


cheers,
0--gg-

--
_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Reply via email to