On Tue, Feb 12, 2002 at 05:07:45PM -0800, Kevin Butters wrote:
[snip]
> @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.

It is, what makes you think it isn't?

Consider:

    @week = qw(Monday Wednesday Friday);
    print "@week\n";

    splice(@week, 1, 0, "Tuesday");
    print "@week\n";

    splice(@week, 3, 0, "Thursday");
    print "@week\n";

This prints:

    Monday Wednesday Friday
    Monday Tuesday Wednesday Friday
    Monday Tuesday Wednesday Thursday Friday

See perldoc -f splice.  If you have questions about how and why this works,
feel free to ask.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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

Reply via email to