Re: hex represenation from string in perl
- From: "John W. Krahn" <someone@xxxxxxxxxxx>
- Date: Tue, 06 Sep 2005 03:27:13 GMT
archilleswaterland@xxxxxxxxxxx wrote:
>
> I have a file with the following contents
>
> 1111
> 1100
> 1001
> .
> .
> .
>
> I read it into an array and want to represent it as hex.
>
> so I want the output to read
>
> f
> c
> 9
> .
> .
> .
>
> Any suggestions ?
$ echo "1111
1100
1001" | perl -lne'printf "%x\n", oct "0b$_" unless /[^01]/'
f
c
9
John
--
use Perl;
program
fulfillment
.
- Follow-Ups:
- Re: hex represenation from string in perl
- From: archilleswaterland@xxxxxxxxxxx
- Re: hex represenation from string in perl
- References:
- hex represenation from string in perl
- From: archilleswaterland@xxxxxxxxxxx
- hex represenation from string in perl
- Prev by Date: Re: maintainable code?
- Next by Date: Re: s/$match/$replace/ fails when $replace has backreferences
- Previous by thread: Re: hex represenation from string in perl
- Next by thread: Re: hex represenation from string in perl
- Index(es):
Relevant Pages
|