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?
$/="!"; $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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: chomp it chomp it good
by ikegami (Patriarch) on Jun 03, 2009 at 05:21 UTC | |
|
Re: chomp it chomp it good
by AnomalousMonk (Archbishop) on Jun 03, 2009 at 05:25 UTC | |
|
Re: chomp it chomp it good
by sflitman (Hermit) on Jun 03, 2009 at 05:26 UTC | |
by perlsaran (Sexton) on Jun 03, 2009 at 09:22 UTC | |
by whakka (Hermit) on Jun 03, 2009 at 17:47 UTC | |
|
Re: chomp it chomp it good
by vinoth.ree (Monsignor) on Jun 03, 2009 at 05:12 UTC | |
by parv (Parson) on Jun 03, 2009 at 10:33 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |