in reply to Re: Limit number of Sub routine argument list
in thread Limit number of Sub routine argument list
#!/usr/bin/perl -w use strict; use Params::Validate qw' validate_pos '; Main( @ARGV ); exit( 0 ); sub Foo { validate_pos( @_, 1, 1, 1 ); print "$_\n" for @_; print "---\n"; } sub Main { Foo(1,2,3); Foo(1,2,3,4); Foo(1,2,3,4,5); } __END__ 1 2 3 --- 1 2 3 --- 4 parameters were passed to main::Foo but 3 were expected at - line 12 main::Foo(1, 2, 3, 4) called at - line 21 main::Main() called at - line 7
|
|---|