my $obj = Stringy->new( 'the look' ); my $counter = 0; for my $it ( a1 => $obj => 2 => 3 => 4, 5 ) { $counter++; print "iteration: $counter "; print "with (" . $it . ")"; print "\n"; } #------------------------------------------------------- package Stringy; use strict; use overload ( '""' => \&toString, ); 1; sub new { my $class = shift; my $self = { appearance => shift, }; return bless $self, $class; } sub toString { my $self = shift; print "[toString called] "; return $self->{appearance}; }