Me writes:
> In the hope this saves Allison time, and/or
> clarifies things for me, I'll attempt some
> answers.
>
Thanks .
> > In your article at perl.com you describes
> > various ways and situations when perl
> > creates a topic and this is described as
> > perl making the following binding on my behalf:
> >
> > $_ := $some_var ; *1*
>
> Well, $_ might not be bound to a named variable
> but instead be just set to a value,
sure , I forgot , e.g.
given $x+1 {
when 2 { ... }
}
or it might
> be bound to an array cell or some other unnamed
> container.
>
>
>
> > is $_ always lexical variable.
>
> Yes.
>
>
> > Or I can have $MyPackage::_ ?
>
> You can copy or alias any value.
no, I mean is '$_' a valid name to live in package namespace ?
$main::_ = 1 ;
$::_ = 1;
our $_ ;
???
or variable with name '$_' is always implicitly "my" ??
> > also
> >
> > @a := ( $a, $b )
>
> Er, I don't think (it makes sense that) you
> can bind to a literal.
I think I meant this :
*@a := ( $a, $b )
although , to be true , I dont understand why the first version is
wrong. Do you mean that @a := expect 1 array variable and I give it
2 scalars ?
but if :
$ref = ( $a, $b ) ;
@a := $ref ;
this , probably is OK, but now changing $a or $b will not affect @a
and vice-versa.
so , anyway,
*@a := ( $a, $b )
> > $c := $b
> > @a[1] = 10 ;
> > print $c # prints 10
???
and also , one more question.
is this correct :
$x is constant = 1;
$y = 5;
$y := $x ;
$y = 1 # ERROR cannot change constant value
or in words, are (all) compile - time properties passed automatically
upon binding ?
thanks ,
arcadi .