In Iterate.pm, I prototype an iterator
subroutine for each type of variable 
that I want to iterate.

sub IterArray(\@&){}
sub IterHash (\%&){}

How would I create a single subroutine name,
like "Iterate", that would be overloaded to
call the IterArray or IterHash sub depending
on the type of variable used in the call?

Iterate @arr  sub { print "value is ".($_[0])."\n"; }
Iterate %hash sub { print "key   is ".($_[0])."\n"; }

Or could there be ambiguities on some data types
where stating the data type explicitely in the subname
would more likely guarantee the expected behaviour?
This is more of a coding style question.

Greg
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to