Perl | chr() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The chr() function in Perl returns a string representing a character whose Unicode code point is an integer. Syntax: chr(Num)Parameters: Num : It is an unicode integer value whose corresponding character is returned .Returns: a string representing a character whose Unicode code point is an integer. Example 1: Perl #!/usr/bin/perl # Taking some unicode integer value as the parameter # of the chr() function and returning the corresponding # characters as output print chr(71), chr(101), chr(101), chr(107), chr(115); print "\n"; print chr(102), chr(111), chr(114); print "\n"; print chr(71), chr(101), chr(101), chr(107), chr(115); Output: Geeks for Geeks Example 2: Perl #!/usr/bin/perl # Initialising an array of some unicode integer values # and retrieving each value and printing their # corresponding characters my @Array = (71, 101, 101, 107, 115); foreach my $element (@Array) { print chr($element); } Output : Geeks Comment More infoAdvertise with us Next Article Perl | atan2() Function K Kanchan_Ray Follow Improve Article Tags : Perl Perl-function Perl-String-Functions Perl-Inbuilt-Functions Similar Reads Perl | cos() Function This function is used to calculate cosine of a VALUE or $_ if VALUE is omitted. The VALUE should be expressed in radians. Syntax: cos(VALUE) Parameters: VALUE in the form of radians Returns: Function returns cosine of VALUE. Example 1: Perl #!/usr/bin/perl # Calling cos function $var = cos(5); # Pri 1 min read Perl | uc() Function uc() function in Perl returns the string passed to it after converting it into uppercase. It is similar to ucfirst() function which returns only first character in uppercase. Note: The characters which are already in UpperCase are not modified. Syntax: uc String Returns: string in uppercase. Example 1 min read Perl | atan2() Function This function is used to calculate arctangent of Y/X in the range -PI to PI. Syntax: atan2(Y, X) Parameters: Y and X which are axis values Returns: Function returns arctangent of Y/X in the range -PI to PI. Example1: Perl #!/usr/bin/perl # Assigning values to X and y $Y = 45; $X = 70; # Calling atan 1 min read Perl | ord() Function The ord() function is an inbuilt function in Perl that returns the ASCII value of the first character of a string. This function takes a character string as a parameter and returns the ASCII value of the first character of this string. Syntax: ord string Parameter: This function accepts a single par 1 min read Perl | hex Function The hex function in Perl converts the given hexadecimal number ( of base 16 ) into its equivalent decimal number ( of base 10 ). Syntax: hex number Parameters: number: hexadecimal number to be converted Returns: equivalent decimal number of the given hexadecimal number. Example 1: Perl #!/usr/bin/pe 1 min read Perl | getc Function getc() function in Perl is used to read the next character from the file whose File Handle is passed to it as argument. If no FileHandle is passed then it takes one character as input from the user. Syntax: getc(FileHandle) Parameter: FileHandle: of the file to be read Returns: the character read fr 1 min read Like