in reply to Re: Pass an optional parameter to a subroutine
in thread Pass an optional parameter to a subroutine
Actually, I think that currently I'd write your code like thismy $ref_mail = shift; my $db_write = @_ ? shift : 1;
That's icky, as it means more to change if there are ever more parameters than just these two. I'd suggest:
my $ref_mail = shift; my $db_write = defined $_[0] ? shift : 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Pass an optional parameter to a subroutine
by Velaki (Chaplain) on Sep 15, 2006 at 17:54 UTC |