sub some_func { # do stuff if (wantarray) { return @results; elsif (defined wantarray) { return \@results; else { warn "this is tedious"; } }