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 we can navigate the xml documents?
How to read from a pipeline with Perl
What is perl programming?
Comment on the scope of variables in perl.
What does last statement do in perl?
What interface used in PERL to connect to database? How do you connect to database in Perl?
What are scalars?
Explain the use of 'my' keyword in perl?
Explain what is STDIN, STDOUT and STDERR?
What is chomp() operator/function?
How will you open a file in read-only mode in perl?
How to copy a file in perl?
Explain goto name?
what is the function that is used to identify how many characters are there in a string?
Explain 'grep' function.