When you assign Nil to a string or any object, it takes its default value.

Cheers



El mié., 12 sept. 2018 a las 10:23, Simon Proctor (<simon.proc...@gmail.com>)
escribió:

> Ooooo learn something new everyday :)
>
> On Wed, 12 Sep 2018 at 08:46 Elizabeth Mattijsen <l...@dijkmat.nl> wrote:
>
>> Also:
>>
>> my $a is default(Nil);
>>
>> > On 12 Sep 2018, at 09:25, Simon Proctor <simon.proc...@gmail.com>
>> wrote:
>> >
>> > If you don't define the type of a Scalar and don't assign to it you'll
>> have an undefined Any (the Parent class of all the other types). If you
>> assign Nil to it then you have the same effect.
>> >
>> > You can make $x to be Nil by iether casting it : my Nil $x; or binding
>> it to Nil; my $x; $x := Nil;
>> >
>> > Basically Nil is special, slippery and a bit hard to catch.
>> >
>> >
>> >
>> > On Wed, 12 Sep 2018 at 06:56 ToddAndMargo <toddandma...@zoho.com>
>> wrote:
>> > What am, I missing?
>> >
>> > $ p6 'my $x; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
>> > Not Nil
>> >
>> > $ p6 'my $x = Nil; if $x =:= Nil { say "Nil" } else { say "Not Nil"; };'
>> > Not Nil
>> > --
>> > Simon Proctor
>> > Cognoscite aliquid novum cotidie
>>
> --
> Simon Proctor
> Cognoscite aliquid novum cotidie
>


-- 
JJ

Reply via email to