perl 初始化Hash
Vsftp:/root/perl/6# cat a5.pl use Data::Dumper; my @arr=qw/a bc d /; my %rec=(); for $field (@arr){ $rec{$field} = $field.33; } print %rec; print "\n"; print Dumper(%rec); print "\n"; Vsftp:/root/perl/6# perl a5.pl aa33dd33bcbc33 $VAR1 = 'a'; $VAR2 = 'a33'; $VAR3 = 'd'; $VAR4 = 'd33'; $VAR5 = 'bc'; $VAR6 = 'bc33';