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
Distinguish my and local?
For a situation in programming, how can you determine that Perl is a suitable?
what is Perl one liner?
How do I sort a hash by the hash key?
How to close a file in perl?
How we can navigate the xml documents?
How to compare two strings in perl?
How many ways can we express string in Perl?
Write a program to download the contents from www.perlinterview.com/answers.php website in Perl.
What is perl? What is the basic command to print a string in perl?
what is the main function of fork() in cgi programming?
What are the functions that can be performed using cgi program?
How to open a directory in perl?
Why do we use "use strict" in perl?
What are the advantages of perl programming?