Re: hex represenation from string in perl



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
.



Relevant Pages