# $1[0] is seen as interpolation, placing the value of "1" into the regexp, which matches with the "1" in our target string. perl -E 'our @array = (1,2,3); *1=\@array; say for @1; say "yes" if "1" =~ m/.?$1[0]/;' 1 2 3 yes