#!/usr/bin/perl -w use strict; use Devel::Timer; my $runcount=500; my $t = new Devel::Timer(); my @array = ('nfs,7,rw', 'afp,12,rro', 'cifs,32,ro', 'dns,5,rw', ); $t->mark('V1'); for my $runs (1..$runcount) { my $cols = []; foreach my $row (0..$#array) { my @cols = split /,/, $array[$row]; map {$cols->[$_]->[$row] = $cols[$_]} (0..$#cols); } } $t->mark('V2'); for my $runs (1..$runcount) { my @splitted_up = (); my $cnt = 0; push @{ $splitted_up[($cnt ++) % 3] }, $_ foreach (split (/,/, join (",",@array))); } $t->mark('V3'); for my $runs (1..$runcount) { my $array2d = []; my @list = map {split /,/,$_}(@array); $array2d->[$_%3][int($_/3)]=$list[$_] for (0..$#list); } $t->mark('V4'); for my $runs (1..$runcount) { my @array2d = (); my $c=0; $array2d[$c%3][int($c++/3)]=$_ for (split /,/, join (",",@array)); } $t->mark('V4 end'); $t->report();