my $errors = {}; #or my $errors=\%existing_hash; my $array_ref=[%$errors]; my $csvout = new IO::File "> csvoutput.csv"; my $status = $csv->print ($csvout, [%$errors])