config_re#

Grep configuration entries whose key matches a pattern.

Synopsis#

use Config;
my @hits = Config::config_re('^cc');

What you get back#

A list of strings in key='value' form, one per matching entry. The pattern is anchored at the start of each key='value' line and must be followed by =, so in practice it matches the key; values are included verbatim in the returned strings.

Examples#

use Config;
my @arch = Config::config_re('arch\w*');  # archname, archlibexp, ...
my @d    = Config::config_re('d_\w+');    # every d_* feature flag

Edge cases#

  • An empty pattern returns no results.

  • A pattern that does not compile returns no results and leaves its error in $@.

Differences from upstream#

Fully compatible with upstream.