実態参照(&#)の変換 Perl
#!/usr/bin/perl use Encode; use utf8; binmode STDOUT, ":utf8"; my $a = "情報時代"; $a =~ s/&#x([0-9A-F]{4});/decode('UCS2', pack('H*', $1))/ge; print "$a\n";
my $a = "情報時代"; use HTML::Entities; print HTML::Entities::decode($a), "\n";
my $a = "情報時代"; $a =~ s/&#x([0-9A-F]{4});/chr(hex($1))/ge; print "$a\n";
スポンサーリンク