Brad Baxter <bmb <at> mail.libs.uga.edu> writes:
>>> perl -E '@a = ("1"); say "1 x" ~~ @a'
>>This is a slightly unperlish distinction; usually in Perl it doesn't matter
>>whether a scalar holds the number 42 or the string '42'
>Perhaps I misunderstand the example, but there is no time that I'm aware
>of when perl would store "1 x" in a scalar as a number.
I was referring to this difference:
% perl -E '@a = ("1"); say "1 x" ~~ @a'
% perl -E '@a = (1); say "1 x" ~~ @a'
1
So you have to be aware of the difference between 1 and '1'.
This is the only place in everyday Perl programming where the difference is
noticeable.
--
Ed Avis <eda@waniasset.com>
Thread Previous
|
Thread Next