If you say "my $foo = 42", you are saying that $x is a box, and you are
putting 42 into it. You can put something else into that box later.

If you say "my $foo := 42", you are saying that $x is 42 itself, not a box
containing 42. You can think of it as a constant of sorts. Because it's not
a box, you can't change what's in the nonexistent box later.

>From here on it gets trickier, because there are things that can use the
box instead of what the box contains, notably Hash elements, and which can
then be changed by changing what's in the box directly instead of by
changing the Hash element.

On Sun, Sep 16, 2018 at 9:02 PM ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/16/2018 05:58 PM, Curt Tilmes wrote:
> > Read this:
> >
> https://perl6advent.wordpress.com/2017/12/02/perl-6-sigils-variables-and-containers/
> >
> > Then go back and read it again.  It took me several times, and I'm still
> > not sure I get it all :)
>
> I am spacing on the difference between
>
>      my $foo  = 42;     and
>      my $foo := 42;
>
> To add insult to injury, I come from Modula2, where
> `:=` is `=` in Perl.
>
> -T
>


-- 
brandon s allbery kf8nh
allber...@gmail.com

Reply via email to