If you want to play with @_ as though it were a hash, I don't think you can get away without a temp hash (%h) without using an explicit loop (or two) like this:sub option { my $self=shift; die unless @_; if (@_ == 1) { return $self->{options}->{+shift}; } my %h=@_; @{$self->{options}}{keys %h}=values %h; }
while(@_) { $self->{options}->{+shift}=shift; }
In reply to Re: setting and retrieving sub-hash elements in an object
by clintp
in thread setting and retrieving sub-hash elements in an object
by Amoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |