thpfft has asked for the wisdom of the Perl Monks concerning the following question:
I quite often seem to do this:
$text = do_something_complicated_to($text);and assume that it's economical that way. But a couple of recent posts have made me suspect that i'm actually creating a whole new variable there. Is this true? if so, there must be a better way.
Is this the way to do it? It feels fragile (and scary):
do_something_complicated_to(\$me);Or maybe there's something one can do by returning a ref that would have a similar effect but where i can see it?
I guess what i really want is this:
$text =~ something_complicated();but since i can't have that, what's the Right Way, please?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: style q: duplication? of variables
by japhy (Canon) on Aug 14, 2001 at 16:51 UTC | |
by stefan k (Curate) on Aug 14, 2001 at 17:10 UTC | |
by trantor (Chaplain) on Aug 14, 2001 at 18:37 UTC | |
by bikeNomad (Priest) on Aug 14, 2001 at 19:10 UTC | |
by stefan k (Curate) on Aug 14, 2001 at 19:46 UTC | |
Re: style q: duplication? of variables
by htoug (Deacon) on Aug 14, 2001 at 16:51 UTC | |
Re: style q: duplication? of variables
by AidanLee (Chaplain) on Aug 14, 2001 at 16:55 UTC | |
Re: style q: duplication? of variables
by nakor (Novice) on Aug 14, 2001 at 17:36 UTC | |
by thpfft (Chaplain) on Aug 14, 2001 at 19:14 UTC | |
Re: style q: duplication? of variables
by dws (Chancellor) on Aug 14, 2001 at 22:41 UTC |