What is the difference between chop & chomp functions in perl?
Answer Posted / pallavi
Chop function removes the last character of any specified
string or variable and returns the chopped data.
Ex: $a="abcdefghijkla";
$b= chop($a);
print $a;
Output - abcdefghijkl
Where as chomp removes all the new line at the end of any
specified string or variable and returns nothing.
Is This Answer Correct ? | 15 Yes | 3 No |
Post New Answer View All Answers
What are the various perl data types based on the context?
What rules must be followed by modules in perl.
How to read multi lines from a file in perl?
Explain subroutine in perl?
List the files in current directory sorted by size ?
What is the use of "stderr()"?
What is the syntax used in Perl grep function?
What are numeric operators in perl?
Explain lists in perl?
Comment on the scope of variables in perl.
How to connect to SQL server through Perl?
Explain the various characteristics of perl.
Define perl scripting?
What is a chop() function in perl?
How to remove a directory in perl?