Jonathan Scott Duff <[EMAIL PROTECTED]> writes:

> On Wed, Jan 29, 2003 at 08:49:42PM +0100, Juergen Boemmels wrote:
> > Solution 3: The autoset sets the value to the default value.
> > 
> >      my Int @a is default(5);
> > 
> >      @a[3] = 3;      # there are now 4 items in the array
> >      @a[2];          # was autoset 5 so returns 5
> >      @a[4];          # doesn't exist, so returns 5
> > 
> >      @a[2] = undef;  # set to undef, so returns undef
> 
> Can someone give me a realish world example of when you would want an
> array that can store both undefined values and default values and those
> values are different?

Ok, here is one

my float @weight_factor is default (1.0);

$weighted_sum = sum (@weight_factor »*« @a);

$weight_factor[4711] = 0.0;

bye
b.
-- 
Juergen Boemmels                        [EMAIL PROTECTED]
Fachbereich Physik                      Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern             Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47

Reply via email to