in reply to Re^2: Hash multiple initialization
in thread Hash multiple initialization

I don't see the point of the prototype. It actually makes your example caller bigger!
my @init_to_toto = qw{ a b c f t u }; my %hash = ( y => 'pre', z => 'pre', ); mass_init(\%hash, \@init_to_toto, 'toto'); mass_init(\%hash, [qw( b g k p )], 'TITI'); use Data::Dumper; print Dumper \%hash; sub mass_init { my ($hashref, $arrayref, $string) = @_; # $hashref->{$_} = $string for @$arrayref; @{ %$hashref }{ @$arrayref } = ($string) x @$arrayref; }