On Tue, 12 Feb 2002 14:46:45 -0800 (PST), Kevin Butters
<[EMAIL PROTECTED]> wrote:
> I have an array with 5 elements, 0-4. I want to insert
> values into the array at position 2. Do I use the
> splice command?
> 
> splice(@array, 1, "value");
> print "@array\n";
> 0 1 2 3 4 5

You forgot the length argument to the splice function

#!/usr/bin/perl -w
use strict;

my @array = (0..4);
print "@array\n";

splice(@array, 1, 1, "value");
print "@array\n";


__END__



-- 
briac
 << dynamic .sig on strike, we apologize for the inconvenience >>


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

Reply via email to