use Type::Params qw( wrap_subs compile_named_oo ); use Types::Standard -types; wrap_subs function_with_positional_parameters => [ ArrayRef, Int, Int ]; sub function_with_positional_parameters { my ( $list, $start, $end ) = @_; my @slice = @{$list}[ $start .. $end ]; return \@slice; } wrap_subs function_with_named_parameters => compile_named_oo( list => ArrayRef, start => Int, end => Int ); sub function_with_named_parameters { my ( $arg ) = @_; my @slice = @{$arg->list}[ $arg->start .. $arg->end ]; return \@slice; }