I'm not entirely sure what you're trying to do - although here's a guess. It's not using hashes (associative arrays), but it could.
use Data::Dumper; my $header = <DATA>; my @cols_h = split /\t/, $header; my @data; while (<DATA>) { chomp; my @info = split /\t/; push @data, \@info; } # uncomment this to see the data we have so far. #print Dumper(\@data); foreach (@data) { my $avg = ($_->[2] + $_->[3]) / 2; push @$_, $avg } # uncomment this to see the data we have so far. #print Dumper(\@data); # at this point, each @data is an array of arrays. # Each of the arrays contained in @data is "anonymous" (unnamed). # These anonymous arrays have the four columns (0-3), and a fifth colu +mn # which is an average of columns 2 and 3 (zero-based). __DATA__ ID_REF IDENTIFIER GSM29783 GSM29784 31307_at L17325 77 788 31308_at L17330 -777 -877 31309_r_at U50277 7 8 31310_at X52009 -7777 -887 31311_at X61070 77777 88
In reply to Re^3: naming a variable with the datum from another variable
by Tanktalus
in thread naming a variable with the datum from another variable
by duncharris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |