Re: hex to ebcdic



Gunnar Hjalmarsson schreef:
roch77:

I have a string of hex that represent ebcdic characters. Is there a
way that I can do the following in perl.

hex string = "f1f2d7d9f0"

the result I want = "12PR0"

From looking up a ascii/hex/ebcdic table, I was able to arrive at
the
result. ie: f1 => 1, f2 => 2, d7 =>P etc..

Is there a perl function that will do this?

There is a module.

use Convert::EBCDIC 'ebcdic2ascii';
$hex = 'f1f2d7d9f0';
( $ebcdic = $hex ) =~ s/(..)/chr(hex $1)/eg;
$ascii = ebcdic2ascii( $ebcdic );

See also Encode.

--
Affijn, Ruud

"Gewoon is een tijger."
.



Relevant Pages

  • hex to ebcdic
    ... I have a string of hex that represent ebcdic characters. ... hex string = "f1f2d7d9f0" ... Is there a perl function that will do this? ... I am doing this in linux if that matters. ...
    (comp.lang.perl.misc)
  • Re: hex to ebcdic
    ... hex string = "f1f2d7d9f0" ... Is there a perl function that will do this? ... See also Encode. ... Gunnar Hjalmarsson ...
    (comp.lang.perl.misc)
  • Re: Regex - need help!
    ... "Gewoon is een tijger." ...
    (comp.lang.perl.misc)
  • Re: convert Vbscript to Perl code
    ... "convert useful VBScript code to Perl" ... "Gewoon is een tijger." ...
    (comp.lang.perl.misc)
  • Re: #$ary ???
    ... Dr.Ruud schreef: ... As of release 5 of Perl, assignment to $[is treated as a com- ... "Gewoon is een tijger." ...
    (perl.beginners)