Perl | chr() Function
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:
#!/usr/bin/perl # Taking some unicode interger 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); |
chevron_right
filter_none
Output:
Geeks for Geeks
Example 2:
#!/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 ); } |
chevron_right
filter_none
Output :
Geeks
Recommended Posts:
- Perl | cos() Function
- Perl | ord() Function
- Perl | uc() Function
- Perl | log() Function
- Perl | oct() Function
- Perl | exp Function
- Perl | each() Function
- Perl | hex Function
- Perl | abs() function
- Perl | tell() Function
- Perl | int() function
- Perl | sin() Function
- Perl | exists() Function
- Perl | split() Function
- Perl | getc Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.