in reply to Setting defaults in subroutines
Further to davorg's explanation, my usual idiom for getting the desired result is to move the default into the dereference:
my @index = @{ $args{Index} || [] };
This sidesteps the problem of @array || something forcing the array into scalar context, and also permits an undefined value.
Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Setting defaults in subroutines
by hmerrill (Friar) on Aug 04, 2004 at 11:26 UTC |