From: rkinyon Date: Thu, 23 Feb 2006 03:54:59 +0000 (+0000) Subject: Converted a for-loop to a map in SPLICE X-Git-Tag: 0-97~16 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df3c5701065fc79bfc0c82b51ce9823747adb466;p=dbsrgits%2FDBM-Deep.git Converted a for-loop to a map in SPLICE --- diff --git a/lib/DBM/Deep/Array.pm b/lib/DBM/Deep/Array.pm index 01fd9fb..0950a12 100644 --- a/lib/DBM/Deep/Array.pm +++ b/lib/DBM/Deep/Array.pm @@ -320,10 +320,9 @@ sub SPLICE { my @new_elements = @_; my $new_size = scalar @new_elements; - my @old_elements = (); - for (my $i = $offset; $i < $offset + $splice_length; $i++) { - push @old_elements, $self->FETCH( $i ); - } + my @old_elements = map { + $self->FETCH( $_ ) + } $offset .. ($offset + $splice_length - 1); ## # Adjust array length, and shift elements to accomodate new section.