Transform array

asked 2018-03-22 03:49:33 -0500

Hi Everyone, This sounds trivial, but I cant wrap my head around what I need to do: I have:


I want to end up with a string that looks like this:

$somestring = "node1=http://node1:2380,node2=http://node2:2380,node3=http://node3:2380"

I have tried this:

 $nodes = ['node1','node2','node3']
 $nodes2 = $nodes $merged =
 concat($nodes,$nodes2) $sorted =
 sort($merged) $test = $sorted.reduce |
 $memo, $value | {
 "${memo}=http://$value:2380," } notify
 {"nodelist is $test":}

But gives me:

edit retag flag offensive close merge delete