Re: What does ord mean?

[email protected] ("Chas. Owens")
Newsgroups perl.macosx
Message-ID <[email protected]>
On Wed, Mar 4, 2009 at 19:58, Vic Norton <[email protected]> wrote:
> I am confused. I can't figure out what ord does. For example I've pasted the
> NO-BREAK-SPACE (00A0) between the quotation marks in the ord of the
> following line.
>   print ord(" "), "\n";
> When I run this line in a Perl script I get
>   194
> What does this 194 mean? As far as I know A0 = 10x16 = 160. And 194
> certainly can't be an octal numeral.
snip

I have a similar problem when copy and pasting in the terminal, but
when I write the characters to a file (or a pipe) it appears to do the
right thing:

perl -le 'print "\x{A0}"' | perl -nle 'print ord'

I assume the problem has to do with UNICODE vs UTF-8.

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.