use strict; use warnings; my %hash = (one => 1, two => 2, three => 3); # create a format picture for use with formline format OUTPUT = @<<<<<<<<< @## $_, $hash{$_} . my $str; open OUTPUT, '>', \$str; write OUTPUT foreach sort keys %hash; close OUTPUT; print $str;