in reply to print arrays a(i), b(i,j) c(i,j)

use List::MoreUtils qw/zip/; sub emit_frobs { my ($a, $b, $c) = @_; for (@$a) { my @fb = map { sprintf "%.5f", $_ } @{shift @$b}; my @ec = map { sprintf "%.5e", $_ } @{shift @$c}; print PLOUT join(' ', $_, zip(@fb, @ec)), "\n"; } } emit_frobs \@energy_bins, \@spec_cps, \@sigma_cps;

I don't understand the rest of your question, sorry.