my %h = ( one => 'v1', two => 'v2', three => { a => 'x', c => 'y' } ); my %norefs = map { $_ => $h{$_} unless ref $h{$_} } keys %h;