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

Answer Posted / nagaraju kancherla

chop() removes the last character from a scalar value.

chomp() checks whether the last characters of a string or
list of strings match the input line separator defined by
the $/ system variable. If they do, chomp removes them.


Is This Answer Correct ?    25 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between "my" and "local" variable scope declarations. ?

562


What are the purpose of close(), getc() and read() functions?

484


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

498


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

531


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

546






How can you create anonymous subroutines?

547


Explain the internal working of cgi

509


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

472


You want to read command-line arguements with perl. How would you do that?

496


What happens when you return a reference to a private variable?

533


What is goto statement in perl?

512


Why do you use Perl?

547


How many types of variable in perl?

554


Mention how many ways you can express string in Perl?

586


What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)

544