Returns the numeric value of the first character of EXPR. If EXPR is an empty string, returns 0. If EXPR is omitted, uses $_.

When utf8 is properly set

examples/ord_utf8.pl

use strict;
use warnings;
use 5.010;
use utf8;

say ord('a');   # 97
say ord('b');   # 98
say ord('A');   # 65
say ord('=');   # 61
say ord('abc'); # 97

say ord('ű');   # 369 (Hungarian)
say ord('ñ');   # 241 (Spanish)

say ord('א');   # 1488 (Hebrew Aleph)
say ord('אב');  # 1488 (Hebrew Aleph and Bet)
say ord('ב');   # 1489 (Hebrew Bet)

say ord('٣');   # 1635 (Arabic 3)


When utf8 is not set

examples/ord.pl

use strict;
use warnings;
use 5.010;

say ord('a');   # 97
say ord('b');   # 98
say ord('A');   # 65
say ord('=');   # 61
say ord('abc'); # 97

say ord('ű');   # 197  (Hungarian)
say ord('ñ');   # 195  (Spanish)

say ord('א');   # 215 (Hebrew Aleph)
say ord('אב');  # 215 (Hebrew Aleph and Bet)
say ord('ב');   # 215 (Hebrew Bet)

say ord('٣');   # 217 (Arabic 3)

See also the chr function as the opposite of ord.