for my $type (keys %$curr_struct_pos) { for my $index (0..@{$cur_struct_pos->{$type}}-1) { $path="Global".$type. "Def:".$curr_struct_pos->{$type}[$a]. ".def"; $curr_struct_pos->{$type}[$a] = extract(); }