in reply to print to data
use sprintf instead of printf and push the resulting strings to an array for later use:
my @fragments; push @lines, sprintf "Percent\t"; for (...) { ... push @fragments, sprintf ...; } push @lines, join '', @fragments; [download]