Skip to content

Instantly share code, notes, and snippets.

@raphink
Created January 22, 2020 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphink/f565bea5e4ba905cb898adb86e70899e to your computer and use it in GitHub Desktop.
Save raphink/f565bea5e4ba905cb898adb86e70899e to your computer and use it in GitHub Desktop.
$a = [
{
a => a1,
b => b1,
c => c1,
},
{
a => a2,
b => b2,
c => c2,
},
{
a => a3,
b => b3,
}
]
$b = $a.map |$h| {
$c = $h[c] ? {
undef => '',
default => ":${h[c]}"
}
"-v ${h[a]}:${h[b]}${c}"
}.join(' ')
notice($b)
# -v a1:b1:c1 -v a2:b2:c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment