What's the point?  Seems to me the only purpose of this code beyond the obvious

    unpack("B*",pack("N", $arg))

line is to reformat the result into an odd, probably application-dependent 
format.



--- On Wed, 11/16/11, Sandro CAZZANIGA <cazzaniga.san...@gmail.com> wrote:

> From: Sandro CAZZANIGA <cazzaniga.san...@gmail.com>
> Subject: decimal -> Binary
> To: fwp@perl.org
> Date: Wednesday, November 16, 2011, 8:26 AM
> hi!
> 
> Just a little JAPH for convert decimal to binary.... Feel
> free to comment
> it ;)
> ----------------------------------------------------------------
> #!/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;
>

Reply via email to