in reply to reading N files

The problem is that the IN you open is the same at each iteration, because it is the filehandle slot into the IN symbol in package main. In your case, it is the same as using global variables: you always access the same variable, and you keep writing on it.

The solutions are in Fletch's post.

perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.