for $type (keys %$curr_struct_pos) { #### for ($a=1;$$curr_struct_pos{$type}[$a];$a++) { #### for my $var ($begin..$end) {#blah} #### my @sorted=sort {$a <=> $b} @numlist; #### $$curr_struct_pos{$type}[$a] #### use strict; use warnings; my %curr_struct_pos; my $curr_struct_pos="hello"; my $type="key"; my $index=0; $$curr_struct_pos{$type}[$index]++; #### $path = "Global${type}Def:$$curr_struct_pos{$type}[$a].def"; #### for my $type (keys %$curr_struct_pos) { for my $index (1..@{$cur_struct_pos{$type}}-1) { $path="Global".$type. "Def:".$curr_struct_pos{$type}[$a]. ".def"; #much easier to read $curr_struct_pos{$type}[$a] = extract(); } #### my %hash; my @list=qw(These elements are going to become keys); map {$hash{$_}++} @list; #or $hash{$_}++ foreach @list; #or with refs... my $hash_ref =\%hash; my $array_ref=\@list; $hash->{$_}++ foreach @$list;