in reply to Help w passing array by ref

You are passing in a reference to an array in the function. References are scalars. The line
my @xpid = shift;
is very misleading. All it does is create a one element array @xpid, whose only element is a reference to the original array. It's better to write the first line as:
my $xpid_ref = shift;

Then, to deference a reference (to get to its juicy content), you place the appropriate sigil in front of the reference (or the block that results in the reference). So, your loop would start with:

foreach my $item (@$xpid_ref) {
Furthermore, if you are looping over an array with
foreach my $element (@array)
don't use an index to get to the element! You already have it in your variant: $element. So, you'd write your loop as:
foreach my $item (@$xpid_ref) { $return .= $item; }
Of course, the entire function body can be reduced to a one-liner:
return join "" => @{+shift}
and then you can take the 'return' off as well.

Abigail