in reply to Uninitialized Value $regex

Perhaps you meant to use qr instead of m:
my $pattern_re = qr/(?:$args{pattern})/;