# find the wheel and restart endpoint my $i = 0; foreach(@{$self->{endpoints}){ my $pname = $_; my $wheel = $self->{wheels}->[$i]; [...] $i++; }