I'll explain in english what I need.
That can be useful but it's fuzzy. Far better to write tests which may or may not work. See How to ask better questions using Test::More and sample data
If you can negate the logic then (from your fuzzy description) I think it should be quite simple:
use strict;
use warnings;
use Test::More;
my @good = qw/PKG_CONFIG_PATH XDG_DATA_DIRS/;
my @bad = qw/XDG_SEAT_PATH XDG_SESSION_PATH/;
plan tests => @good + @bad;
my $re = qr/^XDG.*PATH$/;
for my $str (@good) {
unlike $str, $re, "good $str does not match";
}
for my $str (@bad) {
like $str, $re, "bad $str matches";
}