#!/usr/bin/perl -w
use strict;
my %key_char;
open(F2,'>:encoding(utf-8)',"zhengma_table_2.txt");
open(F,'<:encoding(utf-16)',"zhengma_table.txt");
while(<F>){
if(m/^([^a-z ]*)(.*)$/){
my $char=$1;
my $key=$2;
my @key=split (//s+/,$key);
foreach my $k(@key){
print F2 "$k $char/n";
}
}
else{print "cannot match at $./n";}
}
close(F);
close(F2);
输入:
一a av
一下aa
万无一失aaam
输出:
a 一
av 一
aa 一下
aaam 万无一失