# then to do your substitution: $SQLStatement =~ s/\$(\w+)/$parameters{$1}[0]/eg;