Monthly Archives: January 2014

perl 转汉字到拼音

By | 2014/01/21

使用Lingua写的模块: pm link : search.cpan.org/~fayland/Lingua-Han-PinYin-0.15/lib/Lingua/Han/PinYin.pm #!/usr/bin/perl -w use Lingua::Han::PinYin(); sub getpinyin{ my @value = @_; my $pinyin = ”; for my $out (0 .. $#value){ $pinyin .= $value[$out]; } print “$pinyin”; } open(FH,$ARGV[0]) or die “Can’t find filename:$!”; while() { next if /^#/; my($filmname,$size) = split /\s+/; my $h2p = new Lingua::Han::PinYin(); my @value =… Read More »