in reply to Modifying array data during print

If you don't want to change the the @cols array as you print (your hash keys are untranslated), it's as simple as:

for (@cols) { (my $changed = $_) =~ tr/_/,/; printf("%s,%f\n", $changed, $avgsHash{$_}); }
That just makes a copy before doing translation.

After Compline,
Zaxo