develooper Front page | perl.perl6.language | Postings from February 2004

Re: The Sort Problem: a definitive ruling

Thread Previous | Thread Next
From:
Damian Conway
Date:
February 20, 2004 15:01
Subject:
Re: The Sort Problem: a definitive ruling
Message ID:
403691BE.9020100@conway.org
Smylers wrote:

> Oh.  I'd been assuming that quote marks indicated strings, and that,
> while a string containing only digits could obviously be treated as a
> number (as in Perl 5), it wouldn't be one without being provoked.

Correct.


> What about:
> 
>   $x = '0345';
> 
> Is that a number?  

Nope. A string (unless C<$X> is otherwised typed).


> What about if the variable contains a line read from user input?  As a
> programmer I'd expect that to be a string

You'd be right (unless, of course, the variable's storage type forced a 
coercion during the assignment).


Damian

Thread Previous | Thread Next


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