On Tue, 12 Feb 2002, Kevin Butters wrote:

> Beginner question:
>
> ..
>
>
> I have an array that I want to insert elements into. I
> want to insert elements at specific points in  the
> array.
>
> Example:
>
> use strict:
>
> @week = ("Monday", "Wednesday", "Friday");
>
> I want to expand the array to include Tuesday after
> element 0 and Thursday after element 1
>
> I thought that splice was the correct way but
> apparently not.

Well, it might be that a hash is really what you want, even if you don't
know it yet.

But if you insist on arrays:

@week = ("Mon",undef,"Wed",undef,"Fri");

That will create a sort of "placeholder" for values you know you want to
insert later.

But probably, depending on what you want to do, a hash would be a better
solution.... which begs the question: what do you want to do with this?

Chris



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to