foreach my $value (@temp_reference_value) { .. use unsubsripted $value here ... .."off by one" won't happen... a big advantage! }