This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Optimise %hash in sub { %hash || ... }
[perl5.git] / pp.c
diff --git a/pp.c b/pp.c
index eba4e22..e61894a 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -131,6 +131,9 @@ PP(pp_padhv)
     if (gimme == G_ARRAY) {
        RETURNOP(Perl_do_kv(aTHX));
     }
+    else if (PL_op->op_private & OpMAYBE_TRUEBOOL
+         && block_gimme() == G_VOID)
+       SETs(boolSV(HvUSEDKEYS(TARG)));
     else if (gimme == G_SCALAR) {
        SV* const sv = Perl_hv_scalar(aTHX_ MUTABLE_HV(TARG));
        SETs(sv);