sub array_to_string { my %p = @_; #$p{'switch'} //= '-'; $p{'switch'} = '-' unless exists $p{'switch'}; # edit join $p{'switch'}, @{ $p{'array'} }; } array_to_string( array => [1..3], #switch => '#', );