in reply to '%hash = ()' is slower than 'undef %hash'

I see the opposite. Where's your test? I never trust a benchmark I don't see; they're too easy to get wrong.

>perl a.pl Rate test2 test1 test2 225043/s -- -5% test1 236071/s 5% -- >perl a.pl Rate test2 test1 test2 233861/s -- -5% test1 247248/s 6% -- >perl a.pl Rate test2 test1 test2 224170/s -- -8% test1 243265/s 9% --
$ perl a.pl Rate test2 test1 test2 194855/s -- -10% test1 217061/s 11% -- $ perl a.pl Rate test2 test1 test2 200313/s -- -5% test1 210977/s 5% -- $ perl a.pl Rate test2 test1 test2 195321/s -- -4% test1 203538/s 4% --
use strict; use warnings; use Benchmark qw( cmpthese ); sub test1 { my %h = 'a'..'z'; %h = (); } sub test2 { my %h = 'a'..'z'; undef %h; } cmpthese(-3, { test1 => \&test1, test2 => \&test2, });