Re: hex represenation from string in perl
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 6 Sep 2005 12:32:30 -0700
Jim Gibson wrote:
> <faq>
>
> How do I convert from binary to decimal
> Perl 5.6 lets you write binary numbers directly with the 0b nota-
> tion:
>
> number = 0b10110110;
>
> Using oct:
>
> my $input = "10110110";
> $decimal = oct( "0b$input" );
>
> Using pack and ord:
>
> $decimal = ord(pack('B8', '10110110'));
>
> </faq>
Er. Out of curiousity, what version of Perl is this? That FAQ is not
on my system (This is perl, v5.6.1 built for sun4-solaris), nor is it
at http://perldoc.perl.org/perlfaq.html
Paul Lalli
.
- Follow-Ups:
- Re: hex represenation from string in perl
- From: Jim Gibson
- Re: hex represenation from string in perl
- From: A. Sinan Unur
- Re: hex represenation from string in perl
- References:
- hex represenation from string in perl
- From: archilleswaterland@xxxxxxxxxxx
- Re: hex represenation from string in perl
- From: John W. Krahn
- Re: hex represenation from string in perl
- From: archilleswaterland@xxxxxxxxxxx
- Re: hex represenation from string in perl
- From: Jim Gibson
- hex represenation from string in perl
- Prev by Date: Re: hex represenation from string in perl
- Next by Date: Re: hex represenation from string in perl
- Previous by thread: Re: hex represenation from string in perl
- Next by thread: Re: hex represenation from string in perl
- Index(es):
Relevant Pages
|