Re: hex to ebcdic
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Sat, 30 Jun 2007 14:02:37 +0200
Gunnar Hjalmarsson schreef:
use Encode 'decode';
$hex = 'f1f2d7d9f0';
( $ebcdic = $hex ) =~ s/(..)/chr(hex $1)/eg;
$ascii = decode 'posix-bc', $ebcdic;
Ah, "posic-bc", brings back memories. I would've thought that "EBCDIC"
or "EBCDIC-US" (see `iconv -l`) would work too, but they don't, see
`perldoc Encode::Supported`.
Variant using pack()
$ perl -Mstrict -MEncode=decode -wle'
my $ebcdic = pack q/H*/, $ARGV[0];
my $ascii = decode q/posix-bc/, $ebcdic;
print $ascii;
' f1f2d7d9f0
12PR0
--
Affijn, Ruud
"Gewoon is een tijger."
.
- References:
- hex to ebcdic
- From: roch77
- Re: hex to ebcdic
- From: Gunnar Hjalmarsson
- Re: hex to ebcdic
- From: Dr.Ruud
- Re: hex to ebcdic
- From: Gunnar Hjalmarsson
- hex to ebcdic
- Prev by Date: Re: Going Bananas!!!!!!!!!!!!!!!!!!!!!!!!!!
- Next by Date: Re: Going Bananas!!!!!!!!!!!!!!!!!!!!!!!!!!
- Previous by thread: Re: hex to ebcdic
- Next by thread: FAQ 3.6 How do I profile my Perl programs?
- Index(es):
Relevant Pages
|
|