in reply to Re^2: printing columns of data
in thread printing columns of data

Here's a non-destructive version:
use strict; use warnings; my %hash; $hash{col1} = [qw(a b c d e)]; $hash{col2} = [qw(1 2 3 4 5)]; $hash{col3} = [qw(q r s t u)]; # Change this so that the keys of %hash # show up in the order you want them, # in the output. my @keys = sort keys %hash; # Assumes every key of %hash is an # arrayref with the same number of # elements in it. print join(",", @keys), "\n"; my $ref_key = $keys[0]; my $count = @{ $hash{$ref_key} }; my $pos = 0; while ($pos < $count) { my @line; for my $key (@keys) { push @line, $hash{$key}[$pos]; } print join(",", @line), "\n"; ++$pos; }