use Data::Dumper; use Benchmark qw(timethese); use strict; use warnings; timethese(1000000, { 'loop' => \&s1, 'non-loop' => \&s2 }); sub s1 { my %hash = (a => 3, b=> 4, c=>1 ,d=>7); my @sels = qw(b c); delete $hash{$_} foreach (@sels); } sub s2 { my %hash = (a => 3, b=> 4, c=>1 ,d=>7); my @sels = qw(b c); delete @hash{@sels}; }