Perl | Useful String functions Last Updated : 30 Jun, 2019 Comments Improve Suggest changes Like Article Like Report A string in Perl is a scalar variable and start with a ($) sign and it can contain alphabets, numbers, special characters. The string can consist of a single word, a group of words or a multi-line paragraph. The String is defined by the user within a single quote (‘) or double quote (“). Perl provides various functions to manipulate the string like any other programming language. Example: Perl # Perl program to demonstrate # string length function # string my $s = "geeksforgeeks"; # using length function & # displaying length print("Length: ", length($s)); # Converting to Uppercase print("\nTo Upper Case: "); print(uc($s), "\n"); Output: Length: 13 To Upper Case: GEEKSFORGEEKS Some string functions of Perl are as follows: Function Description chomp() Used to remove the last trailing newline from the input string length() Finds length (number of characters) of a given string, or $_ if not specified substr() Returns a substring out of the string passed to the function starting from a given index up to the length specified uc() Returns the string passed to it after converting it into uppercase ucfirst() Returns the string VAR or $_ after converting the First character to uppercase lc() Returns a lowercased version of VAR, or $_ if VAR is omitted lcfirst() Returns the string VAR or $_ after converting the First character to lowercase chr() Returns a string representing a character whose Unicode code point is an integer chop() Returns a string representing a character whose Unicode code point is an integer index() Returns the position of the first occurrence of given substring (or pattern) in a string (or text) rindex() Returns the position of the last occurrence of the substring (or pattern) in the string (or text) sprintf() Uses Format provided by the user to return the formatted string with the use of the values in the list ord() Returns the ASCII value of the first character of a string quotemeta() It escapes all meta-characters in the value passed to it as parameter split() Used to split or cut a string into smaller sections or pieces Comment More infoAdvertise with us Next Article Perl | Useful String functions A Abhinav96 Follow Improve Article Tags : Perl Perl-String Perl-function Perl-String-Functions Similar Reads Learn Free Programming Languages In this rapidly growing world, programming languages are also rapidly expanding, and it is very hard to determine the exact number of programming languages. Programming languages are an essential part of software development because they create a communication bridge between humans and computers. No 9 min read Perl Programming Language Perl is a general purpose, high level interpreted and dynamic programming language. Perl supports both the procedural and Object-Oriented programming. Perl is a lot similar to C syntactically and is easy for the users who have knowledge of C, C++. Since Perl is a lot similar to other widely used lan 3 min read Perl | Regex Cheat Sheet Regex or Regular Expressions are an important part of Perl Programming. It is used for searching the specified text pattern. In this, set of characters together form the search pattern. It is also known as regexp. When user learns regular expression then there might be a need for quick look of those 6 min read Perl | split() Function split() is a string function in Perl which is used to split or you can say to cut a string into smaller sections or pieces. There are different criteria to split a string, like on a single character, a regular expression(pattern), a group of characters or on undefined value etc.. The best thing abou 8 min read Perl Tutorial - Learn Perl With Examples How to Run a Perl Program? Let's consider a simple Hello World Program. perl #!/usr/bin/perl # Modules used use strict; use warnings; # Print function print("Hello World\n"); Generally, there are two ways to Run a Perl program- Using Online IDEs: You can use various online IDEs which can b 15+ min read Introduction to Perl Perl is a general-purpose, high level interpreted and dynamic programming language. It was developed by Larry Wall, in 1987. There is no official Full form of the Perl, but still, the most used expansion is "Practical Extraction and Reporting Language". Some of the programmers also refer Perl as the 9 min read Perl | Polymorphism in OOPs Polymorphism is the ability of any data to be processed in more than one form. The word itself indicates the meaning as poly means many and morphism means types. Polymorphism is one of the most important concepts of object-oriented programming languages. The most common use of polymorphism in object 4 min read Perl | Loops (for, foreach, while, do...while, until, Nested loops) Looping in programming languages is a feature which facilitates the execution of a set of instructions or functions repeatedly while some condition evaluates to true. Loops make the programmers task simpler. Perl provides the different types of loop to handle the condition based situation in the pro 7 min read Perl | Arrays In Perl, array is a special type of variable. The array is used to store the list of values and each object of the list is termed as an element. Elements can either be a number, string, or any type of scalar data including another variable. Example: @number = (50, 70, 46); @names = ("Geeks", "For", 6 min read Perl | substr() function substr() in Perl returns a substring out of the string passed to the function starting from a given index up to the length specified. This function by default returns the remaining part of the string starting from the given index if the length is not specified. A replacement string can also be passe 2 min read Like