in reply to merge two simple data structures

Interesting question... it seems to me that you could use the 'wantarray' function. Converting a hash to an array is pretty simple: something like this would do the trick. (untested)

sub merge { if(wantarray) { return @_; } else { return join('',@_); } }

Any hash you pass to it should auto-magically convert to an array and then back again so this should work:

my %hash = merge(%hash1,%hash2);

And then scalars or arrays should work to

my @array = merge(@array1,@array2); my $scalar = merge($scalar1,$scalar2); # or like the push function (only you have to get the return value) my @array = merge(@array2,$scalar);

Hope that helps

Chris

Lobster Aliens Are attacking the world!