biofeng918 has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl -w $pi3.14159; print"what is the $radius \n"; chomp($radius<STDIN>); $circuit=2*$pi*$radius; print"this is the circumference of a circle r $radius is\n";

when I fulfill it,the perl metioned me that unrecognized character \xA3 at the line2,reply soon,thank you

Update
#!/usr/bin/perl -w @names=qw/shanghai beijing nanjing hubei/; print "Enter some numbers from 1 to 4, one per line,then press Ctrl-Z. +\n"; chomp(@number=<STDIN>); foreach(@names){ print "$names[$_-1]\n"; }

when i run this program,it works, but still don't knw why

janitored by ybiC: Balanced <code> tags around code snippet, as per Monastery convention

Janitored by Arunbear - retitled from 'help me'

Janitored by Arunbear again {sigh} - added code tags around updated code

Replies are listed 'Best First'.
Re: Unrecognized character in source code
by mattr (Curate) on Oct 09, 2004 at 14:47 UTC
    If you view in firefox (linux) with encoding set to Unicode, you will see that there are two unknown characters where the = sign should be after $pi. Same for the chomp line too. However $circuit is followed by an ordinary equals sign.

    Are you using a non-English environment that uses a front end processors i.e. for Chinese or Japanese?

    If your screen shows an equals sign after $pi then you are not viewing in a western character set.

    It would appear that you inserted one or two double-byte characters. Viewing in Unicode the double-byte equals sign in an unknown encoding shows up as two inverse question mark bullets. Viewed in MacRoman it shows up as two capital angstrom a's (A with a circle over it). Please tell us more about your browser, machine, OS, language. Wierd that you have a good equals sign later.

Re: Unrecognized character in source code
by graff (Chancellor) on Oct 09, 2004 at 14:54 UTC
    I don't understand why the error message would refer to "\xA3" -- in the code you posted (at least, after I downloaded it from PM), lines 2 and 4 contain non-ASCII bytes where I would expect to see a simple ASCII equal-sign ("="). In both lines, the non-ASCII bytes happen to be "\x81\x81". Maybe your local copy has "\xA3" in these places, and there was some sort of conversion error when you tried to paste the code into your post?

    Anyway, whatever text editor you use to write perl code, use it to replace the non-ASCII characters (whatever they are) with "=" on lines 2 and 4.

Re: Unrecognized character in source code
by biofeng918 (Acolyte) on Oct 09, 2004 at 17:02 UTC
    The OS I use is windows 2000 professional and the cpu is AMD Athlon XP 2000+.My native laguage is Chinese,but I write it in English.Most of all,the line2 and line4 in my document is equals sign.And I run it in the Activeperl,I edit it in the notepad.
      It looks like the value pasted into your posting was UTF-8 C3 82 C2 81, which converts to Unicode 81C2, which doesn't make sense as that is in the middle of the Unicode CJK characters.

      Please tell us what font you have selected. And do you have one of the Chinese IME's active? And is the source file Unicode encoded?

      Unfortunately, Unicode has more characters than anyone can handle. Lots of characters can look the same. If I use the WinXP character map program to search for "equals" it shows three different characters:
          U+003D = = Normal equal sign
          U+FF1D = = Fullwidth equals sign
          U+F366 ﹦ ﹦ Small equal sign
      Only the first of these is what Perl will understand.

      A couple more characters that look somewhat similar are:
          U+2550 ═ ═ Box Drawings Double Horizontal
          U+3013 〓 〓 Geta Mark

      And I played around a bit and found that Windows will freely convert the fullwidth equals to a normal equals. But Perl will continue to see them as different.

      Anyway, check what font you are using, and perhaps save the source once as non-Unicode text? (File / SaveAs / Set Encoding to 'ANSI' ) 行 不 行 吗 ?

        I save the source as non-Unicode text,just as you say,the text save as ANSI type,the font I use is Fixedsys