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
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
my @Array = (71, 101, 101, 107, 115);
foreach my $element ( @Array ) {
print chr ( $element );
}
|
Output :
Geeks
Last Updated :
21 Nov, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...