In perl 5.10.1 is it ok to add new members to a hash while iterating through it with the each
operator?
Smth. like in this code (preparing data for Google charts), where I have a hash of hashes of arrays and I am trying to move the last element of each array:
sub split_aclr($) {
my $csvData = shift;
while (my ($csv, $href) = each %$csvData) {
next unless $csv =~ /_ACLR_/i;
my $len = scalar @{$href->{MEASUREMENT}};
if ($len > 1 && $href->{MEASUREMENT}->[$len - 1] eq 'CARRIER_CHANNEL') {
while (my ($key, $arr) = each %$href) {
my $moved = pop @$arr;
$csvData{$csv . '_CARRIER_CHANNEL'} = {$key => [ $moved ]};
}
}
}
}