develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #81016] Document ord("")

From:
Father Chrysostomos via RT
Date:
December 26, 2010 18:12
Subject:
[perl #81016] Document ord("")
Message ID:
rt-3.6.HEAD-5425-1293415929-681.81016-15-0@perl.org
On Mon Dec 20 04:16:06 2010, b_jonas wrote:
> The following patch clarifies what ord("") does in pod/perlfunc.pod.
> 
> From the current documentation, it's not documented what it does, and
> one
> could guess several different things: returns zero, returns undef,
> returns
> zero with a warning, returns undef with a warning, dies.  (There's
> precedent
> for dying: some BASIC implementations give an error if you ask for
> ASC("")
> -- here ASC is their equivalent of our ord function.)
> 
> 
> --- perl-5.13.7/pod/perlfunc.pod	2010-12-20 13:06:48.000000000 +0100
> +++ perl-5.13.7/pod/perlfunc.pod	2010-12-20 13:08:38.000000000 +0100
> @@ -3600,10 +3600,10 @@
> 
>  =item ord
> 
>  Returns the numeric (the native 8-bit encoding, like ASCII or EBCDIC,
> -or Unicode) value of the first character of EXPR.  If EXPR is
> omitted,
> -uses C<$_>.
> +or Unicode) value of the first character of EXPR.  If EXPR is an
> empty
> +string, returns 0.  If EXPR is omitted, uses C<$_>.
> 
>  For the reverse, see L</chr>.
>  See L<perlunicode> for more about Unicode.
> 

Regardless of whether this behaviour is correct, it should be
documented. So I have just applied your patch as 6fae7aa. Thank you.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About