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 two ways to get private values inside a subroutine?
How to add elements in a hash in perl?
Explain chomp, chop, cpan, tk.
Explain subroutine?
Explain regular expression in perl?
How does polymorphism work in perl?
What is q (single q) operator in perl?
Explain lexical variables.
You want to read command-line arguements with perl. How would you do that?
How can you replace the characters from a string and save the number of replacements?
If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?
What is Perl?
What is the difference between die and exit in perl?
What's the difference between /^Foo/s and /^Foo/?
Explain different types of perl operators.