Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Split columns according header delimiter

by kennethk (Abbot)
on Jul 23, 2014 at 15:20 UTC ( [id://1094809]=note: print w/replies, xml ) Need Help??


in reply to Split columns according header delimiter

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1094809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found