Think about Loose Coupling | |
PerlMonks |
Re: Split columns according header delimiterby kennethk (Abbot) |
on Jul 23, 2014 at 15:20 UTC ( [id://1094809]=note: print w/replies, xml ) | Need Help?? |
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 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.
In Section
Seekers of Perl Wisdom
|
|