Hello mark,
Tuesday, June 26, 2001, mark crowe (JIC) <[EMAIL PROTECTED]> wrote:
mcJ> Not entirely true. Try:
mcJ> $string = "0.0";
mcJ> print $string;
mcJ> - prints "0.0"
mcJ> Now try it without the quotes around 0.0
mcJ> - prints "0"
let's try another approach:
$s = "0.0";
print $s,"\n";
$s+=0.1;
print $s,"\n";
C:\TEMP>perl tt.pl
0.0
0.1
mcJ> So there is a difference between strings and numbers. In the $counter case
mcJ> it doesn't make any difference, but for the above case it could be important
mcJ> - "0.0" is true in a boolean evaluation, while 0 is false, for example. I
mcJ> will admit I have no idea how often it is important though.
mcJ> Incidentally, autoincrement also works for strings anyway, try:
mcJ> $a = "a"; $a++; print $a;
mcJ> so your example would work whether $a is being treated as a string or a
mcJ> number
of course, string can not be numbers :) but numbers always can be
converted into strings.
Best wishes,
Maxim mailto:[EMAIL PROTECTED]