What is the difference between chop & chomp functions in perl?

Answer Posted / wicked_sunny

Chop and Chomp are two very similar functions. Both of them
are used to delete symbols from the tail of the given
string. While both work with string and list parameters,
Chop deletes any ending symbol Chomp deletes only specified
substring from the end. If you pass list to any of these
two, all list elements will get processed and the return
value would be the result of last operation.

Is This Answer Correct ?    22 Yes 20 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does delete function do in perl?

511


what are the three groups involved in information sharing?

472


How to convert strings into an array in perl?

510


What is perl shift array function?

515


Explain the arguments for perl interpreter.

519






What is cpan in perl?

542


Give an example of the -i and 0s option usage.

463


What syntax is used for grep() function?

564


What is q (single q) operator in perl?

526


What is the purpose of “_file_ literal” and “_line_ literal” in perl?

529


What are the logical operators used for small scale operations? Explain them briefly.

533


What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?

568


How do I generate a list of all .html files in a directory?

526


What is use of ‘->’ symbol?

529


What is boolean context?

542