Thread perl taschenrechner scientific dec zu bin (3 answers)
Opened by fraggs at 2007-02-12 13:38

renee
 2007-02-12 13:42
#74263 #74263
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Aus dem Perl Cookbook:
Code: (dl )
1
2
3
4
5
6
7
8
9
sub dec2bin {
my $str = unpack("B32", pack("N", shift));
$str =~ s/^0+(?=\d)//; # otherwise you'll get leading zeros
return $str;
}

sub bin2dec {
return unpack("N", pack("B32", substr("0" x 32 . shift, -32)));
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread perl taschenrechner scientific dec zu bin