You have the syntax of the for loop already, so I'm going to guess the problem is printing the array outside of the subroutine in which it is populated - correct? Define the array at the main level, and pass a reference to it to the subroutine. Then, any changes made to the array in the subroutine will be made to the original.
See
perlreftut
use strict;
use warnings;
my (@genome_data_g);
upstream(\@genome_data_g);
foreach $datapoint (@genome_data_g) {
print "$datapoint\n";
}
sub upstream {
my $array_ref = shift;
$$array_ref[1] = 'some value';
}
Update: removed & from subroutine call (line 5).