in reply to Re^2: Scalar and void subroutines
in thread Scalar and void subroutines
So you could:
sub name { die 'ref arg required in void context' if ! defined wantarray and ! +ref $_[0]; my ($arg) = @_; if (ref $arg) { $$arg = 'x'; return; } return 'x'; }
as a check that you've got a ref param in void context.
|
|---|