I understand your curiosity, and I totally support it. For everyone, not just you, claiming efficiency as a reason isn't so strong. The speed and memory difference on a small sentence, of say.. 20 words, might be nearly as fast as some other solutions.
Unless you are doing something that requires user interaction or is time dependent, if it works, and is somewhat readable, your solution is great. If you were dealing with a 5e10 words, yeah, efficiency would really matter. Who would want their machine to run out of memory?
It's like comparing the bubble sort to the merge sort to the quick sort on a small set of data. Oddly enough, bubble sort does really really well since the overhead is so low. But once the size gets significant, it does shitty. AND if you are performing an operation on a small set of data, not only on sorting, it doesn't really matter. It's readable, w/o your explanation. Horay! :)
Play that funky music white boy..
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.