in reply to Re: Re: Re: Re: Surpised by foreach iterator limitation
in thread Surpised by foreach iterator limitation
This clearly demos that $hash{key} is not another scalar, it simply refers to a hash element, which is a scalar. Again, please try to understand the subtle difference between "valid syntax to name an element of a collective, which happened to be a scalar", and "valid syntax for scalar name".use Data::Dumper; %hash = (key => 1); local $hash{key} = 2; print Dumper(\%hash);# print 2 print $hash{key};# also print 2.
You can also say,int a[200];
but is a[100] a valid variable name? no, it is NOT. It can be used to call an array element, but it is not a valid variable name. It is the same situation here.a[100] = 2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Re: Surpised by foreach iterator limitation
by Anonymous Monk on Apr 08, 2003 at 04:34 UTC | |
|
Re: Re: Re: Re: Re: Re: Surpised by foreach iterator limitation
by MarkM (Curate) on Apr 08, 2003 at 03:38 UTC | |
by pg (Canon) on Apr 08, 2003 at 03:48 UTC |