my @refs; push @r, \substr($s, $_, 1) for 0 .. length($s) -1; print $$_ for @refs; # Output ggggggggggggggggggggggggggggggggggggggggggg