title: Perl command line replace for unicode
body: <p>I am trying to replace every word (stored in a tmp file called <code>_id</code>) with a number using shell script. It works fine except for unicode words, for which a number is generated but replacement using Perl does not work. The bash code under question is as below:</p>
  
  <pre><code>x=0
  for id in `cat _id`; do
      echo $x $id
      perl -p -i -e "s/\b$id\b/$x/g" x_graph.dot
      x=$(($x + 1))
  done 
  </code></pre>
  
  <p>Can someone please point out to where the bug is?</p>