in reply to style q: duplication? of variables
if they want to hang on to both the unprocessed string and the processed string. This clutters up the client, leaving little windows where things aren't as they are named. You can close the window somewhat by writing do_something_complicated_to(\my $processed_text = $text); But that's still burdening the client (and burdening whoever has to maintain the code).my $processed_text = $text; do_something_complicated_to(\$processed_text);
It's cleaner and more readable to write my $processed_text = do_something_complicated_to($text);
In practice, this becomes less of an issue when you're writing a routine to side-effect (process) a data structure, and don't want to (or need to) take on the overhead of returning a modified copy of the entire structure.
|
---|