sub some_function { # Stuff here that populates @x return @x > 1 ? \@x : $x[0]; }