in reply to Returning data from wrapped sub

The actual question is why
return wantarry ? @a : $a[0];
isn't the same as
my @a; if(wantarray) { @a = &$ref; } else { $a[0] = &$ref; } ... do something ... return @a;
Try doing
return (wantarray ? @a : $a[0]);
That should work. The issue is how return works with wantarray.

------
We are the carpenters and bricklayers of the Information Age.

Vote paco for President!