summaryrefslogtreecommitdiffstats
path: root/MDK/Common/DataStructure.pm
diff options
context:
space:
mode:
Diffstat (limited to 'MDK/Common/DataStructure.pm')
-rw-r--r--MDK/Common/DataStructure.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/MDK/Common/DataStructure.pm b/MDK/Common/DataStructure.pm
index 8619e03..afc4ae1 100644
--- a/MDK/Common/DataStructure.pm
+++ b/MDK/Common/DataStructure.pm
@@ -1,6 +1,7 @@
package MDK::Common::DataStructure;
use MDK::Common::Math;
+use MDK::Common::Func;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK);
@@ -35,8 +36,12 @@ sub next_val_in_array {
sub list2kv {
- [ grep_index { MDK::Common::Math::even($::i) } @_ ],
- [ grep_index { MDK::Common::Math::odd($::i) } @_ ];
+ my (@k, @v);
+ for (my $i = 0; $i < @_; $i += 2) {
+ push @k, $_[$i + 0];
+ push @v, $_[$i + 1];
+ }
+ \@k, \@v;
}
1;