use strict; use warnings; my %options = map {$_ => 0} qw(one two three); $options{two} = 1; # Set in some unspecified place for my $option (grep {$options{$_}} keys %options) { print "Option '$option' was used\n"; }