"Premature binding" is one reason to avoid writing
do_something_complicated_to(\$text);
This style of interface prematurely ties the hands of clients, forcing them to write
my $processed_text = $text;
do_something_complicated_to(\$processed_text);
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).
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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.