converter.pm (9780544f) | converter.pm (dba1a2e4) |
---|---|
1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 291 unchanged lines hidden (view full) --- 300 301################################################################# 302# Copying an item collector 303# A reference to an array consisting of references to hashes. 304################################################################# 305 306sub copy_collector 307{ | 1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 291 unchanged lines hidden (view full) --- 300 301################################################################# 302# Copying an item collector 303# A reference to an array consisting of references to hashes. 304################################################################# 305 306sub copy_collector 307{ |
308 my ( $oldcollector ) = @_; | 308 my ($oldcollector) = @_; |
309 310 my @newcollector = (); 311 | 309 310 my @newcollector = (); 311 |
312 for ( my $i = 0; $i <= $#{$oldcollector}; $i++ ) | 312 foreach my $oldhash (@$oldcollector) |
313 { 314 my %newhash = (); | 313 { 314 my %newhash = (); |
315 my $key; | |
316 | 315 |
317 foreach $key (keys %{${$oldcollector}[$i]}) | 316 while (my ($key, $value) = each %$oldhash) |
318 { | 317 { |
319 $newhash{$key} = ${$oldcollector}[$i]->{$key}; | 318 $newhash{$key} = $value; |
320 } 321 322 push(@newcollector, \%newhash); 323 } 324 325 return \@newcollector; 326} 327 --- 131 unchanged lines hidden --- | 319 } 320 321 push(@newcollector, \%newhash); 322 } 323 324 return \@newcollector; 325} 326 --- 131 unchanged lines hidden --- |