title: How to add element to existing list without creating new variable in erlang?
body: <p>I have a list contains some elements and now with the help of <code>lists:foreach</code> I am fetching some more records and I want to append each value to my existing list elements without creating new variable as doing in other languages with help of array.</p>
  <p>Here is my sample code which I am getting:</p>
  <pre><code>exception error: no match of right hand side value [6,7,1].
  </code></pre>
  <p>Sample Code:</p>
  <pre><code>listappend() -&gt;
      A = [1,2,3,4,5],
      B = [6,7],
      lists:foreach(fun (ListA) -&gt;
          B = lists:append(B, [ListA])                       
          end, A),
      B.
  </code></pre>
  <p>I want output like,</p>
  <pre><code>B = [6,7,1,2,3,4,5].
  </code></pre>