Perl Hash Slice, Replication x Operator, and sub params
- by user210757
Ok, I understand perl hash slices, and the "x" operator in Perl, but can someone explain the following code example from here (slightly simplified)?
sub test{
my %hash;
@hash{@_} = (undef) x @_;
}
Example Call to sub:
test('one', 'two', 'three');
This line is what throws me:
@hash{@_} = (undef) x @_;
It is creating a hash…