#!/usr/bin/perl #replace_selected use strict; use Encode qw(from_to); my $inText = $ARGV[1]; $inText =~ s/&#(\d+);/ &refDecode( $1 ) /gie; print $inText; sub refDecode { my $inCode = shift; my $theChar = pack( 'n', $inCode ); &from_to( $theChar, 'UCS-2BE', 'shiftjis' ); return $theChar; }