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

Answer Posted / shaheed

If there is new line character at the end of string, chop()
and chomp() both will remove that new line character.

Else if there is no new line character at the end of string
then chop() will remove last character from the string
while chomp() keeps the string unchanged.

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.

1786


what are the steps involved in reading a cgi script on the server?

490


What is the function of virtual documents in cgi programs?

522


What is v-strings?

596


what is perl language?

504






Why Perl aliases are considered to be faster than references?

535


What is the difference between single (') and double (") quote in a string in perl?

479


What interface used in PERL to connect to database? How do you connect to database in Perl?

527


What does undef function in perl?

515


What is the importance of perl warnings?

531


How can the user execute a long command repeatedly without typing it again and again?

500


How to access parameters passed to a subroutine in perl?

529


Which feature of perl provides code reusability?

565


How will you create a file in perl?

517


What is automatic error handling in perl?

493