use constant MATCHES => join '|' => qw/ a list of words /; sub method { return "something complex here" } my $obj = bless []; my %hash = qw/ this is a hash /; print "it's a hash - @{[ %hash ]}\n"; print "method result - ${ \$obj->method }\n"; print "a regexp object - ", qr[\b (?: ${\MATCHES} ) \b]x, $/; __output__ it's a hash - this is a hash method result - something complex here a regexp object - (?x-ism:\b (?: a|list|of|words ) \b)