In the scope/context provided, it doesn't make sense to use regex to achieve "Hello zy". If it's always going to be "Hello " followed by index 2 and index 1 of @a array, then just make it: my $s = 'Hello ' . $a . $a; which can be easily parametarised in that format. Or even use splice. why the regex?
the hardest line to type correctly is: stty erase ^H