http://www.perlmonks.org?node_id=767884

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Simple question. How does chomp change the contents of the string without the need to pass it in by reference?


ex:
$/="!"; $chomper = "chomp! chomp! chomp!"; chomp($chomper); print $chomper; #outputs chomp! chomp! chomp

....but notice I didn't need to pass in \$chomper for a reference to the scalar and its value changed anyway. How is this done?