sub test { my $hash_ref = $_[0]; my $nr = $_[1]; $hash_ref->{'foo' . $nr} = "test$nr"; }