On Thu, 18 Jul 2002, darren chamberlain wrote:
> sub list_splice_vmeth {
> my ($list, $offset, $length, @replace) = @_;
>
> return list_slice_vmeth($list, $offset, $length)
> unless (@replace);
>
> # Destructive!
> splice @$list, $offset, $length, @replace;
> return "";
> }
I don't see why the case where you're replacing should be the only one
that's destructive here. For example, even two argument splice in perl is
destructive:
@foo = (1,2,3,4,5);
@bar = splice(@foo,2);
print Dumper \@foo;
print Dumper \@bar;
$VAR1 = [
1,
2
];
$VAR1 = [
3,
4,
5
];
I don't like the difference in the two ways splice operates. Either it
should return what splice with perl would do (and modify the original
array) or it should return a modified copy of the array after the
splicing and leave the original intact (and if you need to get the bits
back you're disregarding you should ask slice for them prior
to splicing)
Does this all make sense or have I totally lost the plot?
Mark.
--
s'' Mark Fowler London.pm Bath.pm
http://www.twoshortplanks.com/ [EMAIL PROTECTED]
';use Term'Cap;$t=Tgetent Term'Cap{};print$t->Tputs(cl);for$w(split/ +/
){for(0..30){$|=print$t->Tgoto(cm,$_,$y)." $w";select$k,$k,$k,.03}$y+=2}