N
NewsHound
I've been playing around with Perl for a while, but I'm still something of
a beginner. I was wondering what happens in the following case. Take
a "foreach" loop iterating through the sorted keys of a hash:
foreach $key (sort keys %hash) {
# do stuff here
}
Does the "sort" function re-sort the keys before each iteration of the
"foreach" loop? I was wondering if it is possible to insert additional
elements into the hash in the body of the loop code and have the
sort function operate on them for the next iteration of the loop?
Thanks,
Mike
a beginner. I was wondering what happens in the following case. Take
a "foreach" loop iterating through the sorted keys of a hash:
foreach $key (sort keys %hash) {
# do stuff here
}
Does the "sort" function re-sort the keys before each iteration of the
"foreach" loop? I was wondering if it is possible to insert additional
elements into the hash in the body of the loop code and have the
sort function operate on them for the next iteration of the loop?
Thanks,
Mike