title: linux command wc output format
body: <p>I need to write a perl that mimic linux command <code>wc</code> exactly(including and especially output format), while having realized the functionality, the output of <code>wc</code> is really a headache, it seems that it is changing all the time, the following are a few examples(I will use □ to represent space character)<br>
  1. <code>wc test_input_1</code> ⇒ <code>□□705673□□4234032□26754553□test_input_1</code><br>
  2. <code>wc test_input_2</code> ⇒ <code>□14□□79□581□test_input_2</code><br>
  3. <code>wc test_input_2 -w</code> ⇒ <code>79□test_input_2</code><br>
  4. <code>wc test_input_2 -wc</code> ⇒ <code>□79□581□test_input_2</code><br>
  5. <code>cat test_input_2 | wc</code> ⇒ <code>□□□□□14□□□□□□79□□□□□581</code><br>
  6. <code>cat test_input_2 | wc -w</code> ⇒ <code>79</code><br>
  7. <code>cat test_input_2 | wc -wc</code> ⇒ <code>□□□□□79□□□□□581</code>  </p>
  
  <p>anyone knows how wc formats its output? Any help is appreciated, thanks a lot. </p>