$ cat test.pl use strict; use Benchmark qw[ cmpthese ]; our @tests = ( (undef) x 1000, ("") x 1000, (chr(0)) x 1000, (0) x 1000, (1) x 1000, ("fred") x 1000, ); cmpthese -1, { a => q[ !(defined && length() ) and 1 for @tests; ], b => q[ !defined || $_ eq "" and 1 for @tests; ], c => q[ ($_ // "") eq "" and 1 for @tests; ], }; $ repeat 5 perl test.pl Rate b a c b 1950/s -- -18% -33% a 2379/s 22% -- -18% c 2901/s 49% 22% -- Rate b a c b 1950/s -- -22% -33% a 2511/s 29% -- -13% c 2901/s 49% 16% -- Rate b a c b 1950/s -- -23% -32% a 2536/s 30% -- -12% c 2875/s 47% 13% -- Rate b a c b 1914/s -- -22% -32% a 2466/s 29% -- -12% c 2801/s 46% 14% -- Rate b a c b 1950/s -- -23% -32% a 2536/s 30% -- -12% c 2875/s 47% 13% --