$ perl -wE 'sub f(&) { shift->() }; say f { wantarray }' 1