sub fred { ... unless( defined wantarray ) { ...void context } elsif( wantarray ) { ...list context } else { ...scalar context } }