http://qs321.pair.com?node_id=573069


in reply to Pass an optional parameter to a subroutine

You're being bitten by the fact that 0 is false, so if you pass 0 in $db_write, the shift || 1 sees false || 1 and you get 1.

You will probably want to explicitely check for definedness instead:

my $ref_mail = shift; my $db_write = shift; # If $db_write is defined, use that, otherwise default to 1 $db_write = defined($db_write)?$db_write:1;

CU
Robartes-