sub this{ my ($input) = @_; my %hash = (hash => example); my @array = qw(array example); my $scalar = "scalar example"; query(%hash); #renamed get_data to query ;) query(@array); query($scalar); } sub query{ my ($var) = @_; my $data_type = ref($var); if($daya_type eq 'ARRAY'){ print "is array\n"; return @array }; #d +o functions here for get_array if($data_type eq 'HASH') {print "is hash\n"; return %hash }; #do f +unction here for get_hash .... ect .... } this is untested as well, just as example to understand what i mean