in reply to Weird hash access problem

Change your regex, you're capturing the spacing:
if ($test =~ /([a-hA-H][1-8])\s*to\s*([a-hA-H][1-8])/) {