title: Map and join an array in a Rails view
body: <p>I have an array in Ruby:</p>
  
  <p><code>arr = ["aba", "bab", "abb"]</code></p>
  
  <p>I want to replace all of the "a" with "c", then join the elements together with a semi-colon.</p>
  
  <pre><code># Replace "a" with "c"
  replaced_arr = arr.map {|element| element.sub("a", "c") }
  
  # Join with a ";"
  joined_string = replaced_arr.join(";")
  
  # "cbc; bcb; cbb"
  </code></pre>
  
  <p><strong>How can I do this in a Rails view</strong>?</p>
  
  <p>Doing 
  <code>&lt;%= arr.map(|element| element.sub("a", "c")).join(";") %&gt;</code> gives me the error <code>syntax error, unexpected keyword_end, expecting ')'</code></p>