title: Strange behaviour with command-line perl
body: <p>I have a file that I'm trying to modify using perl from the terminal in Ubuntu Linux (Natty).</p>
  
  <p>The name of the file is vm.args and the first two lines are as follows:</p>
  
  <pre><code>## Name of the riak node
  -name riak@127.0.0.1
  </code></pre>
  
  <p>I am trying to use perl to update the ip address. Below is my code:</p>
  
  <pre><code>riak_ip=`ifconfig eth1 | grep "inet addr" | cut -d ":" -f2 | cut -d " " -f1`
  perl -0777 -i -pe "s/(\-name[\t ]*riak\@)[^\n]+/\1$riak_ip/g" vm.args
  </code></pre>
  
  <p>Let's assume the ip address I get is 10.181.106.32. The perl command gives me a result I can't understand. The resulting first two lines in the my file after I run the above in the terminal become:</p>
  
  <pre><code>## Name of the riak node
  H.181.106.32
  </code></pre>
  
  <p>Which is the letter H and part of the ip address.</p>
  
  <p>I can't seem to figure out what I'm doing wrong and will appreciate some assistance.</p>
  
  <p>Thanks in advance.</p>