in reply to returning variable from within regex
elsif($var1=~/($var2[a-z]{1})/){ $var3 = $1; } [download]
That {1} is not needed and the variable names need to be descriptive - @var2 and $var1 are not meaningful.