in reply to Re^5: RFC: beginner level script improvement (various comments)
in thread RFC: beginner level script improvement
Yes, you should of course use whatever you feel most comfortable with.
FYI, here are two even shorter ways to write that if clause... ;)
# using a loop: if (@_) { $self->{$_} = shift for qw(stuff1 stuff2 stuff3); } # using a hash slice (probably the fastest alternative): @$self{qw( stuff1 stuff2 stuff3 )} = @_ if @_;
(The @ sigil in front of the $self hashref is not a typo - see Slices for more info on that.)
|
|---|