use constant { ARRAY_REF = [1,2,3,4,5], STRING => '.+?', }; # I NEED TO USE '\' with the constant if ($line =~ /${\STRING}/); # while on the other side I use '+' with the CONSTANT HERE print "hey!" if (grep {/ERROR/} @{+ARRAY_REF});