in reply to why does array return the hash value?

Emm...Here is how the code looks like and i would like the output to be "my_sub0_sub1" but because @array pass the hash value into the $variable and sometimes it would cause the output become "my_sub1_sub0". But removing the sort in foreach loop seems to solve this issue, which makes me puzzle:/
my $style ="my_"; foreach$variable (sort @array){ my $id = XMLP::GetElementAttribute($variable,"ID"); $sub .= "_sub" ; $sub .= $id ; } $style .= $sub;