Perl ord Function



Description

This function returns the ASCII numeric value of the character specified by EXPR, or $_ if omitted. For example, ord('A') returns a value of 65.

Syntax

Following is the simple syntax for this function −

ord EXPR

ord

Return Value

This function returns Integer.

Example

Following is the example code showing its basic usage −

#!/usr/bin/perl -w

print("ord() ", ord('G'), "\n");

When above code is executed, it produces the following result −

ord() 71
perl_function_references.htm
Advertisements