use strict; my $txt=callMe(1,2,3); print "txt=$txt\n"; my @tmp=callMe(1,2,3); print "tmp=@tmp\n"; my %list=callMe(1,2,3); foreach my $key (keys(%list)){print "list{$key}=$list{$key}\n";} sub callMe{ my @in=@_; if(wantarray){ #how do I determine if the caller wants an array or a hash? return reverse(@in); } else{return join(",",reverse(@in));} }