in reply to Setting defaults in subroutines
Rather than setting %args from @_ and then adding in defaults, I tend to use something along the lines of:
sub foo { my @defaults = ( Index => [], weeble => "floop", ); my %args = ( @defaults, @_ ); for( @{ $args{ Index } } ) { ## ... } }
You might also want to check out Params::Validate, which provides checking of parameters and allows you to specify default values where required.
|
|---|