use warnings; use strict; use Benchmark; my $data=" this is a string example"; my @data; my $count = 100000; timethese($count, { 'map_split' => sub {@data=map { $_.="\n" } split (/\n/, $data);}, 'simple_split' => sub { @data = split "\n",$data; }, 'regex' => sub { @data= ( $data =~ /(.*?\n)/g );}, } ); __END__ Benchmark: timing 100000 iterations of map_split, regex, simple_split... map_split: 2 wallclock secs ( 2.04 usr + 0.00 sys = 2.04 CPU) @ 48947.63/s (n=100000) regex: 2 wallclock secs ( 1.24 usr + 0.00 sys = 1.24 CPU) @ 80515.30/s (n=100000) simple_split: 1 wallclock secs ( 0.75 usr + 0.00 sys = 0.75 CPU) @ 132978.72/s (n=100000)