{ my $x; sub set_x { validate($_[0]); $x = $_[0]; } sub get_x { die("uninitialized") if !defined($x); $x } }