use strict; use warnings; my $a_or_b; $a_or_b->{a} = 'a'; #should be okay $a_or_b->{b} = 'b'; #should be okay $a_or_b->{c} = 'c'; #should generate an error