#!perl use strict; use warnings; use Benchmark; my $s1 .= 'Peter geht nach Hause geht'; my $s2 = 'Peter nach Hause geht'; ## Method number one - a numeric sort sub test_concat { my $string = shift; my $s1x; for (1 .. 100000) { $s1x .= $string; undef $s1x; } return $s1x; } ## Method number two - an alphabetic sort sub test_normal { my $string = shift; my $s1x; for (1 .. 100000) { $s1x = $string; undef $s1x; } return $s1x; } ## We'll test each one, with simple labels my $count = 100; timethese ( $count, { 'Method One' => sub{ test_concat($s1); }, 'Method Two' => sub{ test_normal($s1); }, } ); exit(0);