echo "410211341\n410138341\n410211401" | perl -F"" -anle '$s=0;$s+=(10-$_)*$F[$_]for(0..8);$s=(11-$s%11)%11;$s="X"if$s==10;print$_.$s' 410211341X 4101383413 4102114017