=item @values = find_directive_elements ( $directive, $key )
+=item $count = find_directive_elements ( $directive, $key )
+
Search the DIRECTIVE arrayref for KEY elements and return their associated
values. An empty list is returned if no KEY elements are found in
DIRECTIVE. The KEY comparison is case-insensitive.
The values returned from this procedure are tainted.
+In scalar context, return the number of entries that would be returned in
+list context.
+
=cut
sub find_directive_elements {
my $directive = shift;
my $key = lc shift;
- return map $_->[1], grep lc($_->[0]) eq $key, @$directive;
+ if (wantarray) {
+ return map $_->[1], grep lc($_->[0]) eq $key, @$directive;
+ } else {
+ return grep lc($_->[0]) eq $key, @$directive;
+ }
}
=item $directory = find_directory ( $directive )