plscript/merge.pl
    --------------------------------------------------
    #変数にファイル名を代入
    $fileA = "data/nihongoA.cha";
    $fileB = "data/nihongoB.cha";

    #各ファイルを読み込み用に開く
    open (INA, $fileA) or die;
    open (INB, $fileB) or die;

    #各ファイルから1行づつ読み込めるあいだ,
    while ($textA = <INA> and $textB = <INB>) {

       
       if ($textA eq $textB) {       #2つのファイルの対応する
                                     #行の内容が同じなら,
          $textA =~ s/^\*/\n\*/;     #* で始まっていたら改行を挿入し,
          print $textA;              #$textA (=$textB) を出力する。

       } else {                      #同じでなければ,

          #[改行] を取り,'(ファイル名)' を付け,[改行] 付きで出力する
          chomp $textA; print "$textA ($fileA)\n";
          chomp $textB; print "$textB ($fileB)\n";
       }

    }
    
    exit;
    --------------------------------------------------