Cross Reference: ord.t
xref
: /
osnet-11
/
usr
/
src
/
cmd
/
perl
/
5.8.4
/
distrib
/
t
/
op
/
ord.t
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
#!./perl
1
N/A
1
N/A
BEGIN
{
1
N/A
chdir
't'
if
-d
't'
;
1
N/A
@
INC
=
qw
(. ../
lib
)
;
# ../lib needed for
test.deparse
1
N/A
require
"
test.pl
"
;
1
N/A
}
1
N/A
1
N/A
plan
tests
=>
7
;
1
N/A
1
N/A
# compile time evaluation
1
N/A
1
N/A
# 'A' 65 ASCII
1
N/A
# 'A' 193 EBCDIC
1
N/A
1
N/A
ok
(
ord
(
'A'
)
==
65
||
ord
(
'A'
)
==
193
,
"ord('A') is "
.
ord
(
'A'
)
)
;
1
N/A
1
N/A
is
(
ord
(
chr
(
500
)
)
,
500
,
"compile time chr 500"
)
;
1
N/A
1
N/A
# run time evaluation
1
N/A
1
N/A
$x =
'ABC'
;
1
N/A
1
N/A
ok
(
ord
($x)
==
65
||
ord
($x)
==
193
,
"ord('$x') is "
.
ord
($x)
)
;
1
N/A
1
N/A
ok
(
chr
65
eq
'A'
||
chr
193
eq
'A'
,
"chr can produce 'A'"
)
;
1
N/A
1
N/A
$x =
500
;
1
N/A
is
(
ord
(
chr
($x)
)
, $x,
"runtime chr $x"
)
;
1
N/A
1
N/A
is
(
ord
(
"\x{1234}"
)
,
0x1234
,
'compile time ord \x{....}'
)
;
1
N/A
1
N/A
$x =
"\x{1234}"
;
1
N/A
is
(
ord
($x)
,
0x1234
,
'runtime ord \x{....}'
)
;
1
N/A