filehandle => sub { my @lines; open my $str_fh, "<", \$str or die "cannot open fh $!"; while (<$str_fh>) { chomp; s/o/i/g; push @lines, $_; } }, #### perlbrew exec bench_script.pl # Other versions of Perl, omitted for brevity - see original link # for the "gories..." ... perl-5.26.0 ========== Rate index regex split filehandle index 3.00/s -- -25% -49% -53% regex 3.98/s 33% -- -33% -37% split 5.91/s 97% 49% -- -6% filehandle 6.31/s 111% 59% 7% -- #### perl-5.30.0 =========== Rate regex index split filehandle regex 9.98/s -- -11% -32% -33% index 11.2/s 12% -- -23% -25% split 14.6/s 46% 30% -- -2% filehandle 14.9/s 49% 33% 2% -- #### perl-5.28.1 (Windows 10 Pro) ============================ Rate regex index filehandle split regex 8.09/s -- -14% -17% -33% index 9.46/s 17% -- -3% -22% filehandle 9.73/s 20% 3% -- -20% split 12.2/s 50% 29% 25% -- #### perl -V ======= ==> cc='gcc' ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields' optimize='-s -O2' cppflags='-DWIN32' ccversion='' gccversion='7.1.0' ... Built under MSWin32 Compiled at Dec 2 2018 14:30:03 @INC: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib