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

Answer Posted / ramya

chop removes the last character and returns the character
chopped
Chomp removes any trailing string that corresponds to the
current value of $/ and returns number of characters removed

Is This Answer Correct ?    11 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you add two arrays together?

527


Does Perl have objects? If yes, then does it force you to use objects? If no, then why?

547


How to concatenate strings in perl?

591


What are perl array functions?

528


what is Chop & Chomp function does?

595






How to dereference a reference?

564


How do I do fill_in_the_blank for each file in a directory?

546


What is the difference between exec and system?

559


Explain the difference between die and exit in perl?

440


How to create a directory in perl?

530


Explain grooving and shortening of arrays?

707


How do you turn on the perl warnings?

499


Write the program to process a list of numbers.

504


What does undef function in perl?

523


What are scalar data and scalar variables?

636