Jim Green writes:
Hello,
I usually use my ($arg1, $arg2) = @_;
to get the arguments parsed to a subroutine.
I want this to be smarter. Sometimes I want to pass $start, $end to
the sub, sometimes I want to pass $start, $count to the sub.
but in this case my ($arg1, $arg2) = @_; will get confused, it
doesn't know if the argument is meant to be $end or to be $count.
does subroutine have some mechanism like getopt::long and it can know
what kind of arguments are passed in?
Jim,
You could pass a hash reference instead.
%arg = (start=>'..',end=>'..',count=>'..');
the_func(\%arg);
Regards.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/