On Fri, Jul 19, 2002 at 08:52:08AM +0100, Andy Wardley ([EMAIL PROTECTED]) wrote: > I'm trying to do the simplest thing with splice() but not seeing the > results I expect. It seems to go weird when I passed an array of > arguments rather than a direct list. > > my (@list, @result, @args); > > # first, the working example > @list = qw( a b c d e ); > @result = splice(@list, 3, 1); > > print "splice remains: @list\n"; # a, b, c, e > print "splice result: @result\n"; # d > > # now the not-so-working example > @list = qw( a b c d e ); > @args = (3, 1); > @result = splice(@list, @args); > > print "splice remains: @list\n"; # a, b > print "splice result: @result\n"; # c, d, e > > The summary: splice() seems to get confused if you call it as > splice(@list, @args). > > Am I missing something obvious?
You get the same result if you try splice(@list, 2); So it looks like splice is somehow forcing scalar context on your array or arguments. Dave... -- ...she opened strange doors that we'd never close again