in reply to Custom printing of an HoA

bioinformatics,
I am not exactly sure I understand. What I think you are looking for is for each "row" to consist of a single element from a list of arrays. This might be what you wanted. I tested it with dummy data.

#!/usr/bin/perl -w use strict; use Text::CSV; my %data = ( one => [ qw(a b c d e f g h i j k) ], two => [ qw(1 2 3 4 5 6 7 8) ], three => [ qw(john jacob jingle heimer smitz) ] ); my @keys = sort keys %data; my $max = 0; for ( @keys ) { $max = @{$data{$_}} if @{$data{$_}} > $max; } Excel(\@keys); for my $index ( 0 .. $max ) { my @temp; for my $key ( @keys ) { push @temp, defined $data{$key}->[$index] ? $data{$key}->[$ind +ex] : ''; } Excel(\@temp); } sub Excel { my $array = shift; my $csv = Text::CSV->new; if ( $csv->combine(@{$array}) ) { my $string = $csv->string; print $string, "\n"; } else { my $err = $csv->error_input; print "combine() failed on argument: ", $err, "\n"; } }
Cheers - L~R

Update: Added Text::CSV stuff since it sounded like the output is going to Excel.