Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: (golf) Interlaced Strings

by japhy (Canon)
on May 02, 2001 at 07:16 UTC ( #77223=note: print w/replies, xml ) Need Help??

in reply to (golf) Interlaced Strings

Answers of varying lengths:
sub interlace { # 52 my$x=pop;my$y=reverse+pop;$x=~s/./chop($y).$&/esg;$x } sub interlace { # 47 my$x=pop;@_=split//,pop;$x=~s/./shift.$&/esg;$x } sub interlace { # 45 ($_,@_)=(pop,split//,pop);s/./shift.$&/esg;$_ }
The last two suffer a mandatory 'shift without parens' warning.

Update: here's a shorter one, without said warning.

sub interlace { # 43 $_=shift;@_=split//,pop;s/./$&.shift/esg;$_ }

japhy -- Perl and Regex Hacker

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://77223]
[atcroft]: choroba: I found something in the GitHub repo for it where someone suggested changing the limit in the search result URL, but I don't know how effective that will be....

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2017-04-29 05:45 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.