You forgot the -n
switch, which will iterate over each line of input, loading one line at a time into $_
and executing the code provided in the -e
argument.
More concisely, you could write your program like
perl -MEncode -pi.bak -e '$_=encode("utf-8",decode("shiftjis",$_))' filename