Not entirely true. Try:
$string = "0.0";
print $string;
- prints "0.0"
Now try it without the quotes around 0.0
- prints "0"
So there is a difference between strings and numbers. In the $counter case
it doesn't make any difference, but for the above case it could be important
- "0.0" is true in a boolean evaluation, while 0 is false, for example. I
will admit I have no idea how often it is important though.
Incidentally, autoincrement also works for strings anyway, try:
$a = "a"; $a++; print $a;
so your example would work whether $a is being treated as a string or a
number
Cheers
Mark C
>
> Hello mark,
>
> Tuesday, June 26, 2001, mark crowe (JIC)
> <[EMAIL PROTECTED]> wrote:
>
> mcJ> If I might make one other little comment - I suggest you
> initialise $counter
> mcJ> by $counter=0, rather than $counter="0"; The former
> makes it a number, the
> mcJ> latter a string.
> (jfyi only)
> you are mistaken. all variables in perl saves as strings; then,
> perl converts string - depends of your needs.
>
> try:
>
> $a="0";
> $a++;
> print $a;
>
> Best wishes,
> Maxim mailto:[EMAIL PROTECTED]
>
>