Hello! I am trying to cut down on the number of code lines I am using but am ending up with a fairly simple problem (although it's stumping me since I am just starting to wrap my head around references)
I am trying to concatenate several values in a particular order.. My code looks like this..
my $separator = ":";
my @vals = qw(name last-name first-name phone);
my $return_name;
$return_name = map {
$return_name = $return_name . $query->param($_) . $separator
} @vals;
What I am getting is "4", instead of concantenating all into one string.
What I am trying to achieve is a shorter version of ...
$return_name = $query->param('name') .
$separator . $query->param('last-name') .
$separator . $query->param('first_name') .
$separator . $query->param('phone');
(I'm actually trying to string together about 25 $query->params
. I only gave four for brevity)