use Sub::Called; sub dummy { return 1; } sub foo { print Sub::Called::with_ampersand(), "\n"; } my %hash = ( dummy => &dummy(), foo => foo(), );