First, please read
How do I post a question effectively?. In particular, you should wrap sample input in
<code> tags to keep things properly formatted and to preserve white space. As an added bonus in this case, the results from that are rendered in monospace, which would make your sample clearer. Also suggested in that document is that you demonstrate effort. What have you tried? What worked, or didn't? As well, providing you actual expected output makes things more obvious that trying to explain in words.
In terms of the question you've asked, the most obvious approach from my perspective would be to use index to find the locations of the + symbol, and then use substr to grab the chunks out of the target row.
Alternatively, you could split on + (split /\+/, $string since + is a regular expression Metacharacters), and then use the
substr EXPR,OFFSET,LENGTH,REPLACEMENT
invocation of
substr to destructively take chunks of your target row according to the
length of each chunk of
-s from the header.
Update: Edit of original node makes much of the content above moot.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
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.