develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [gherteg@csc.com: your CPAN page on EBCDIC]

Thread Next
From:
PPrymmer
Date:
November 4, 2003 07:01
Subject:
Re: [gherteg@csc.com: your CPAN page on EBCDIC]
Message ID:
OF9A22A404.A32A5C26-ON85256DD4.00522E92-85256DD4.005268A4@factset.com




Glenn's analysis of the pod is correct.  Here is a patch of perlebcdic.pod
as shipped with perl 5.8.1:

--- perlebcdic.pod;-1   Tue Nov  4 09:53:12 2003
+++ perlebcdic.pod      Tue Nov  4 09:55:02 2003
@@ -664,13 +664,13 @@
     '\060\061\062\063\064\065\066\067\070\071\263\333\334\331\332\237' ;

     my $ebcdic_string = $ascii_string;
-    eval '$ebcdic_string =~ tr/\000-\377/' . $cp_037 . '/';
+    eval '$ebcdic_string =~ tr/' . $cp_037 . '/\000-\377/';

 To convert from EBCDIC 037 to ASCII just reverse the order of the tr///
 arguments like so:

     my $ascii_string = $ebcdic_string;
-    eval '$ascii_string = tr/' . $cp_037 . '/\000-\377/';
+    eval '$ascii_string =~ tr/\000-\377/' . $cp_037 . '/';

 Similarly one could take the output of the third column from recipe 0 to
 obtain a C<$cp_1047> table.  The fourth column of the output from recipe
End of Patch.

Peter Prymmer

(See attached file: perlebcdic.patch)


Jarkko Hietaniemi <jhi@iki.fi> wrote on 11/04/2003 01:45:42 AM:

> ----- Forwarded message from Glenn Herteg <gherteg@csc.com> -----
>
> Subject: your CPAN page on EBCDIC
> From: "Glenn Herteg" <gherteg@csc.com>
> Date: Mon, 3 Nov 2003 16:13:17 -0800
> Message-ID:
<OF2A74C8DC.25171052-ON88256DD4.0000BC58-88256DD4.00016C5B@com>
> To: jhi@iki.fi
>
> Hello,
>
> I was using this page:
>
> http://search.cpan.org/~jhi/perl-5.8.1/pod/perlebcdic.pod
>
> and noticed some problems.
>
> (1) In this line:
>
>     eval '$ascii_string = tr/' . $cp_037 . '/\000-\377/';
>
>     the operator should be =~ rather than = .
>
> (2) In these two lines, once (1) is corrected:
>
>     eval '$ebcdic_string =~ tr/\000-\377/' . $cp_037 . '/';
>     eval '$ascii_string =~ tr/' . $cp_037 . '/\000-\377/';
>
>     You have, in fact, got the "tr" arguments exactly backward in each
case,
>     given your definition of the $cp_037 string.
>
> Glenn
>
> ----- End forwarded message -----
>
> --
> Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this
special
> biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen
Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About