### Re^2: Split string into equal parts

by kalyanrajsista (Scribe)
 on May 29, 2010 at 13:57 UTC ( #842169=note: print w/replies, xml ) Need Help??

in reply to Re: Split string into equal parts
in thread Split string into equal parts

Thank you ikegami, You're one-liner is awe-some but unfortunately I'm still using Perl 5.8.8 and thus unable to use your solution. Just curious to know any other solution which works in any version of Perl

Replies are listed 'Best First'.
Re^3: Split string into equal parts
by ikegami (Pope) on May 31, 2010 at 03:29 UTC
```s/.{4}\K(?=.)/ /sg;
is an optimisation of
```s/(.{4})(?=.)/\$1 /sg;

Create A New User
Node Status?
node history
Node Type: note [id://842169]
help
Chatterbox?
 [oiskuu]: You want to draw the path? \$iter = combinations( \$TOP_HEIGHT .. \$NODE_HEIGHT, \$pos); then get the path from the iter, level change at depth x, for(..) \$pos += \$level_change; something like that [oiskuu]: yergh, tags... [\$top_height .. \$node_height] [Eily]: Discipulus by demonstrate I suppose you mean simulate with perl? [Eily]: the demonstration itself is fairly easy. The number of paths on a node is the sum of the numbers of paths to the two nodes above (or one node above on the edges of the triangle) [Eily]: since the value of a node is also the sum from the two nodes above, you just have to demonstrate that the equality is true at the top of the triangle [Discipulus]: yes Eily, thanks oiskuu but i dont get it.. ;=( maybe I'll ask a SOPW [LanX]: all combinations with same amount of left and right? [Eily]: if you want to store in a structure with the coordinates as key, arrays might do, since the keys are going to be 0..n

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2018-03-19 11:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (239 votes). Check out past polls.

Notices?