open (input_file,"input.txt") || die"cannot open file"; open (output_file,"output.txt") || die"cannot open file"; $line = input_file; while ($line ne "") { @words = split(/[(,"]/,$line); if($word[0]=~/write_x/) { foreach(@word) { print $index; if( $_=~/write_x/) { print output_file_ex ("writing.reg(\"$word2\").write($word[5,]$word[4]);\n");} } else { print output_file_ex ($line); } $line = ; }