in reply to Re: Maintaining strict refs while Binding a set of variables to @_ or dying if they are not defined
in thread Maintaining strict refs while Binding a set of variables to @_ or dying if they are not defined

If you don't mind changing the calling conventions of your subroutine, go a step further and use named arguments in the form of a hash:
sub someFunc { my %args = @_; my @arglist = qw{ client_number MM DD S }; foreach (@arglist) { die "$_ not given" unless exists $args{$_}; } # Now use $args{client_number} and $args{MM} }
  • Comment on Re: Re: Maintaining strict refs while Binding a set of variables to @_ or dying if they are not defined
  • Download Code