To round off, just a quick comment on 'join' that may clarify things. As
zengargoyle says, you don't need to worry about the efficiency of built-ins - if a language has a command, it's usually worth using it, rather than 'rolling your own'.
In the example you give though, if "$x='4:6:8'" is exactly what you want to end up with, then by all means, type it out in full. In most real-life situations though, that list of numbers is likely to come from somewhere else - my $x = join(":",@list_of_user_supplied_data" or something.
Also, from a readability point of view, seeing a 'join(":")' followed later by a 'split(":")' makes your intention more obvious.
Hope this helps.
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.