use strict; use warnings; my %abc = ( to => 'def', from => 'ghi', ); my @ab = map { "-$_" } keys %abc; print "$_\n" for @ab;