sub build_attributes { my ($options, @valid) = @_; my @attributes; my %validH; undef @validH{ @valid }; while (my ($attr, $value) = each %$options) { push @attributes, qq($attr="$value") if exists $validH{$attr}; } return @attributes; }