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
Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?
Explain ivalue?
What are different data types that perl supports. Elaborate on them.
explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.
How interpreter is used in perl?
What is goto statement in perl?
What is the importance of perl warnings?
How to prevent file truncation in perl?
Why to use perl?
what is the function of Return Value?
What does this symbol mean '->'?
What is eval function in perl?
What is 'rollback' command in perl?
Which has highest precedence in between list and terms? Explain?
How can we create perl programs in unix, windows nt, macintosh and os/2 ?