use strict; my $one = 0; my $two = 1; my $three = 0; my @strings = qw (one two three); my @optionsToCheck = ($one, $two, $three); foreach my $string (@strings) { print "Option $string was used\n" if ( ${"$string"} ); }