sub g { return { ... } } sub h { return { ... } } my $hash = (f ? g : h);