use LWP::UserAgent; use HTML::Parser; use Encode; # Grab a HTML document from the Net. # Extract links from HTML document (legacy encoding, in this case Big5). # Decode linked strings # In my original post I used from_to($linktext, big5, utf-8)'s # in-place conversion. Same error, though. $linktext = decode( 'big5-eten', $linktext, Encode::FB_HTMLCREF ); # Test linked texts against a list of strings #Loop of linked texts foreach ( @keywords ) { local $_ = decode('utf-8', $_); # Force utf-8 flag if ( $linktext =~ /$_/ ) { # Do something } } # Typically the initial iterations appear OK but the loop never completes # before the Wide Character error shows up. # End of loop