s/iter filehandle regex index split filehandle 100 -- -97% -97% -98% regex 3.50 2758% -- -14% -42% index 3.02 3217% 16% -- -33% split 2.02 4868% 74% 50% -- #### s/iter regex index split filehandle regex 3.69 -- -2% -29% -39% index 3.63 2% -- -27% -38% split 2.63 40% 38% -- -15% filehandle 2.25 64% 61% 17% -- #### filehandle2 => sub { open my $str_fh, "<", \$str or die "cannot open fh $!"; my @lines = <$str_fh>; for (@lines) { chomp; s/o/i/g; ; } }, #### $ perl bench_split.pl s/iter regex index split filehandle2 filehandle regex 3.44 -- -10% -35% -45% -48% index 3.11 11% -- -28% -39% -42% split 2.24 53% 39% -- -16% -20% filehandle2 1.89 82% 65% 19% -- -5% filehandle 1.80 92% 73% 25% 5% -- #### filehandle3 => sub { open my $str_fh, "<", \$str or die "cannot open fh $!"; my @lines = map { chomp; s/o/i/g } <$str_fh>; }, #### $ perl bench_split.pl s/iter filehandle3 regex index split filehandle filehandle3 3.64 -- -7% -16% -39% -51% regex 3.38 8% -- -9% -34% -47% index 3.07 18% 10% -- -28% -42% split 2.22 64% 52% 38% -- -20% filehandle 1.77 105% 90% 73% 25% --