in reply to length() and Unicode

I think you should open FILEIN with :utf8 also, that is
open (FILEIN, "<:utf8", $ARGV[0]) || die "Unable to open source file $ARGV[0] : $!\n";