#! perl -slw use strict; use Benchmark qw[ cmpthese ]; our @tests = ( (undef) x1000, ('') x1000, (chr(0)) x1000, (0) x1000, (1) x1000, ('fred') x1000, ); cmpthese -1, { a => q[ !(defined && length() ) and 1 for @tests; ], b => q[ !defined || $_ eq '' and 1 for @tests; ], }; __END__ C:\test>junk Rate b a b 1029/s -- -17% a 1239/s 20% -- C:\test>junk Rate b a b 1065/s -- -1% a 1079/s 1% --