in reply to Re^3: Correct idiom for default parameters
in thread Correct idiom for default parameters
ehm ... $self defaults to 1??? ;-)
IMHO better catch $self in a separate shift!
UPDATE:
> The overwhelming majority of the cases there is one parameter that is optional. Which means that the predominant use will look like this:
Then better avoid this construct!
IMHO it's much clearer (and faster) to write
my ($self,$a,$b,$c,$d)=@_; $d = 4 unless defined $d;
Cheers Rolf
|
|---|