Currently I have a code that does something close to thisA|{NameTag}|Command|{Name}|{Parameters...}
my ($self,$nametag,$name,@params) = @_;#receives input from user my $tmp = { 'NameTag' => $nametag, 'Name' => $name, }; #i don't know how to extract the contents of @params and put it in the + $tmp hash my $InputRequest = $Obj->CreateString($tmp); } sub CreateString { ( my $self, my $hash ) = @_; $str = "A|" . $hash->{'NameTag'} . "|"."Command"."|" . $hash->{'Name'} . "|" return ($str); }
The problem is the user can send a command with multiple parameters in the form of an array like (a,b,c,d) the number of elements in the array may vary. HOw do I internally create a hash that can accomodate all the members of the array and concatenate it in the form a|b|c|d and put it in the form
A|{NameTag}|Command|{Name}|a|b|c|dPlease help.. I know only very basic perl.
Thank youIn reply to Creating a dynamic hash from an array by Buddyhelp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |