I need to process the elements of a hash into a string. This so that the string can be used as a named parameter call in a method.
Given below is a sample hash
This needs to be processed into : "description => $description, new-role-name => $new-role-name, role-name => $role-name" The code that i've written :$VAR1 = [ { 'description' => '$description', 'new-role-name' => '$new-role-name', 'role-name' => '$role-name', } ];
gives the outputwhile(my ($param_key, $param_value) = each(%{$args->{parameter_set}})) + { $param_string.= "$param_key => $param_value,"; } print "\n$param_string\n";
"description => $description, new-role-name => $new-role-name, role-na +me => $role-name,"
What's not correct in the output above is the comma at the end of the string.How do i correct this ?
Thanks in advance!
In reply to Transform hash elements into a string by perlpal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |