in reply to How to improve my code? main concern:array as hash element

Gi => @gi is different from Gi => "@gi"

both make @gi interpolate
the first one is

Gi => $gi[0], $gi[1] => $gi[2],
however the second is
Gi => "$gi[0] $gi[1] $gi[2]"