Website hosting service by Active-Venture.com
  

 Back to Index

FUNCTION DIFFERENCES

chr()

chr() must be given an EBCDIC code number argument to yield a desired character return value on an EBCDIC machine. For example:

 
    $CAPITAL_LETTER_A = chr(193);  

ord()

ord() will return EBCDIC code number values on an EBCDIC machine. For example:

 
    $the_number_193 = ord("A");  

pack()

The c and C templates for pack() are dependent upon character set encoding. Examples of usage on EBCDIC include:

 
    $foo = pack("CCCC",193,194,195,196);
    # $foo eq "ABCD"
    $foo = pack("C4",193,194,195,196);
    # same thing

    $foo = pack("ccxxcc",193,194,195,196);
    # $foo eq "AB\0\0CD"  

print()

One must be careful with scalars and strings that are passed to print that contain ASCII encodings. One common place for this to occur is in the output of the MIME type header for CGI script writing. For example, many perl programming guides recommend something similar to:

 
    print "Content-type:\ttext/html\015\012\015\012"; 
    # this may be wrong on EBCDIC  

Under the IBM OS/390 USS Web Server or WebSphere on z/OS for example you should instead write that as:

 
    print "Content-type:\ttext/html\r\n\r\n"; # OK for DGW et alia  

That is because the translation from EBCDIC to ASCII is done by the web server in this case (such code will not be appropriate for the Macintosh however). Consult your web server's documentation for further details.

printf()

The formats that can convert characters to numbers and vice versa will be different from their ASCII counterparts when executed on an EBCDIC machine. Examples include:

 
    printf("%c%c%c",193,194,195);  # prints ABC  

sort()
EBCDIC sort results may differ from ASCII sort results especially for mixed case strings. This is discussed in more detail below.
sprintf()

See the discussion of printf() above. An example of the use of sprintf would be:

 
    $CAPITAL_LETTER_A = sprintf("%c",193);  

unpack()
See the discussion of pack() above.

 

  

 

Domain name registration - 
Register cheap domain name from $7.95 and enjoy free domain services 
 

Cheap domain name search service -
Domain name services at just
$8.95/year only
 

Register domain name -
Buy domain name registration and cheap domain transfer at low, affordable price.

© 2002-2004 Active-Venture.com Web Site Hosting Service

 

[ Large increases in cost with questionable increases in performance can be tolerated only in race horses and women.   ]

 

 
 
 

Disclaimer: This documentation is provided only for the benefits of our web hosting customers.
For authoritative source of the documentation, please refer to http://www.perldoc.com