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
How do I read command-line arguments with Perl?
Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?
What is the use of -w, -t and strict in Perl?
Is perl compiler or interpreter?
what is perl language?
What does last statement do in perl?
Comment on data types and variables in perl.
Is there any way to add two arrays together?
How to access parameters passed to a subroutine in perl?
How do I sort a hash by the hash value?
What are the reasons that cookie server can’t handle multiple connections?
what are the strategies followed for multiple form interaction in cgi programs?
What are the advantages of c over Perl?
what is Polymorphism in Perl?
you are required to replace a char in a string and store the number of replacements. How would you do that?