# take the values in @array and use them as a hash slice to make all of the values 1 @hash{@array} = (1) x @array; #### # take the values in @array and use them as keys in %hash, incrementing the values associated with said keys by one for (@array) { $hash{$_}++; } #### $hash{$_}++ for (@array); # same as above only with the for at the end #### print+map{sprintf'&#%d;',$_}unpack'C*',$_; #### print map { sprintf '&#%d;', $_ } unpack 'C*', $string; #### print map { sprintf '&#%d;', $_ } unpack 'C*', $string; #### $VAR1 = { 'YZ0' => undef, 'MNO' => undef, 'ABC' => '111111111', 'DEF' => undef, 'STU' => undef, 'VWX' => undef, 'JKL' => undef, 'PQR' => undef, 'GHI' => undef }; #### $VAR1 = { 'YZ0' => 1, 'MNO' => 1, 'ABC' => 1, 'DEF' => 1, 'STU' => 1, 'VWX' => 1, 'JKL' => 1, 'PQR' => 1, 'GHI' => 1 }; #### @hash{@array} = (1 x @array);