## ## _fd() ## ## Arguments: ## ARGUMENTS: arrayref -- The arguments to a subroutine ## DEFAULTS: arrayref -- The defaults for those arguments ## ## Returns: ## list -- The elements of ARGUMENTS. Any elements in ARGUMENTS are replaced ## by the corresponding element in DEFAULTS. ## sub _fd { my ($args, $defaults) = @_; my @filled = (); foreach (0 .. max($#$args, $#$defaults)) { push @filled, ( defined( $args->[$_] ) ? $args->[$_] : $defaults->[$_] ); } return @filled; } sub max { ($_[0] > $_[1]) ? $_[0] : $_[1]; }